Closed Bug 1484948 Opened 7 years ago Closed 7 years ago

Parse dynamic module import syntax

Categories

(Core :: JavaScript Engine, defect)

61 Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla64
Tracking Status
firefox64 --- disabled
firefox65 --- fixed

People

(Reporter: jonco, Assigned: jonco)

References

Details

Attachments

(2 files)

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
Status: NEW → RESOLVED
Closed: 7 years ago
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.

Attachment

General

Created:
Updated:
Size: