Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid scope in JS export statement #1309

Closed
skyronic opened this issue Nov 15, 2017 · 4 comments
Closed

Invalid scope in JS export statement #1309

skyronic opened this issue Nov 15, 2017 · 4 comments

Comments

@skyronic
Copy link

Using dev build of Sublime (3153)

Scope of some code in built-in JS implementation

image

Same file and location with the Babel package:

image

@n-kort
Copy link

n-kort commented Nov 15, 2017

#1302 probably related and relevant.

@Thom1729
Copy link
Collaborator

This behavior is correct. The export default form requires a trailing semicolon. In this example, there is no semicolon, so the syntax will assume that the exported expression continues until it reaches either a semicolon, an unexpected character, or a lookahead indicating that the automatic semicolon insertion algorithm would add a semicolon. A related example:

export default {
    foo: 42
}
/* some comment */
['foo'];

This will export 42. The line ['foo'] is not an array literal, but a property access. See this comment for more details.

Previous versions of the JavaScript syntax handled this incorrectly, resulting in a number of bugs. PR #1009 restructured the syntax definition so that it would systematically do the right thing in these sorts of cases. Unfortunately, the Vue syntax assumes that when the closing </script> tag is encountered, the JavaScript syntax will only have the main scope on the stack. The Vue syntax will have to be modified to handle embedded JavaScript correctly.

@Thom1729
Copy link
Collaborator

Thom1729 commented Jan 6, 2018

@skyronic Since we've sorted out the Vue stuff, can this issue be closed?

@wbond
Copy link
Member

wbond commented Feb 12, 2018

This appears to be resolved now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants