Parse dynamic module import syntax

RESOLVED FIXED in Firefox 65

Status

()

defect
RESOLVED FIXED
Last year
10 months ago

People

(Reporter: jonco, Assigned: jonco)

Tracking

61 Branch
mozilla64
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox64 disabled, firefox65 fixed)

Details

Attachments

(2 attachments)

Currently any use of an |import(specifier)| expression in scripts is a SyntaxError.  In classic scripts, any use of |import| at all is an error and in module scripts it is an error because it's not a valid import statement.

As a step towards implementing dynamic import, this bug is to make the engine parse this syntax but throw an error when it is encountered.  This won't change observable behaviour except:

 - probably the type of error thrown will be different
 - Reflect.parse will succeed for this syntax
Patch to parse dynamic import syntax.

This adds a CallImport parse node and makes the bytecode emitter throw when it encounters it.  I added tests to check we can parse this.

I had to update the wpt test expectations because the dynamic import tests now fail in a slightly different way.
Attachment #9002770 - Flags: review?(jorendorff)
Update to previous patch to make this throw a syntax error rather than an internal error until dynamic import is implemented.
Attachment #9006554 - Flags: review?(jorendorff)
Comment on attachment 9002770 [details] [diff] [review]
bug1484948-parse-dynamic-import

Review of attachment 9002770 [details] [diff] [review]:
-----------------------------------------------------------------

I'm sorry for the slow review here. Looks good.
Attachment #9002770 - Flags: review?(jorendorff) → review+
Comment on attachment 9006554 [details] [diff] [review]
bug1484948-parse-dynamic-import-2

Review of attachment 9006554 [details] [diff] [review]:
-----------------------------------------------------------------

That's better. Thanks.
Attachment #9006554 - Flags: review?(jorendorff) → review+
Pushed by jcoppeard@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/d1b2141b1c45
Parse dynamic module import syntax but throw SyntaxError if used r=jorendorff
https://hg.mozilla.org/mozilla-central/rev/d1b2141b1c45
Status: NEW → RESOLVED
Closed: Last year
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
Depends on: 1489782
Depends on: 1503009
This was reverted for Fx64 in bug 1503009. It remains on Fx65+.
You need to log in before you can comment on or make changes to this bug.