WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
170174
ES2015 modules - Export default function hoisting
https://bugs.webkit.org/show_bug.cgi?id=170174
Summary
ES2015 modules - Export default function hoisting
Guy Bedford
Reported
2017-03-28 03:37:21 PDT
The following circular reference case should work as export default can be used with function declarations that are hoisted, according to the rules of the HoistableDeclaration lookahead (
https://tc39.github.io/ecma262/#prod-HoistableDeclaration
). Instead, Safari gives the following error: SyntaxError: Importing binding name 'a' is not found. a.js: ``` import b from './b.js'; b(); export default function a () { console.log('a'); } ``` b.js: ``` import a from './a.js'; export default function b () { a(); } ``` Where a `<script type="module" src="a.js"></script>` is included in the page. This can be verified to work in the named exports hoisting case by converting the example to use `export function a ()`, `import {a}`, etc.
Attachments
Patch
(2.47 KB, patch)
2017-06-02 03:09 PDT
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Guy Bedford
Comment 1
2017-03-28 03:39:40 PDT
Updated link to the "export default HoistableDeclaration" rule -
https://tc39.github.io/ecma262/#prod-ExportDeclaration
.
Yusuke Suzuki
Comment 2
2017-06-02 03:03:40 PDT
Yeah, this bug is now fixed by fixing hoisting rules in JSC. I'll add this specific test into JSC's module tests :D
Yusuke Suzuki
Comment 3
2017-06-02 03:09:44 PDT
Created
attachment 311812
[details]
Patch
Guy Bedford
Comment 4
2017-06-02 06:37:56 PDT
Great to heat that! The tests could be mixed together to form Mocha tests though :P
Yusuke Suzuki
Comment 5
2017-06-02 18:16:49 PDT
Comment on
attachment 311812
[details]
Patch Thanks ;)
Yusuke Suzuki
Comment 6
2017-06-02 18:18:57 PDT
(In reply to Guy Bedford from
comment #4
)
> Great to heat that! The tests could be mixed together to form Mocha tests > though :P
Mocha is also one of my favorite drink ;)
WebKit Commit Bot
Comment 7
2017-06-02 18:35:03 PDT
Comment on
attachment 311812
[details]
Patch Clearing flags on attachment: 311812 Committed
r217747
: <
http://trac.webkit.org/changeset/217747
>
WebKit Commit Bot
Comment 8
2017-06-02 18:35:05 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug