-
Notifications
You must be signed in to change notification settings - Fork 781
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
Support dynamic import call #1740
Conversation
Codecov Report@@ Coverage Diff @@
## master #1740 +/- ##
======================================
Coverage 100% 100%
======================================
Files 1 1
Lines 4012 4038 +26
Branches 706 712 +6
======================================
+ Hits 4012 4038 +26
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Maybe a test showing it can't be used in a newExpression? Approving regardless.
@@ -1789,10 +1813,14 @@ export class Parser { | |||
statement = this.parseExportDeclaration(); | |||
break; | |||
case 'import': | |||
if (!this.context.isModule) { | |||
this.tolerateUnexpectedToken(this.lookahead, Messages.IllegalImportDeclaration); | |||
if (this.matchImportCall()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, interesting, import can be called from scripts? Nice to know!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's my interpretation, not sure if it's correct or not. @domenic do you have an opinion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, definitely.
Good point, I can definitely at that. |
Ah, I also still forget to tackle the case such as |
I get an error with a stack trace that leads to
in parser.ts, while parsing valid es2018. It seems that |
Fix #1728