Closed
Bug 1340147
Opened 8 years ago
Closed 7 years ago
Wrong function name assigned to default export function
Categories
(Core :: JavaScript Engine, defect, P3)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla59
Tracking | Status | |
---|---|---|
firefox59 | --- | fixed |
People
(Reporter: anba, Assigned: anba)
References
Details
(Keywords: triage-deferred)
Attachments
(1 file)
(deleted),
patch
|
jonco
:
review+
|
Details | Diff | Splinter Review |
Test case, m.js:
---
import f from './q.js';
print("NAME: ", f.name);
---
q.js:
---
export default function() { };
---
Expected: Prints "NAME: default"
Actual: Prints "NAME: *default*"
Spec:
14.1.20 Runtime Semantics: InstantiateFunctionObject
Production |FunctionDeclaration : function(FormalParameters){FunctionBody}|, step 3
https://tc39.github.io/ecma262/#sec-function-definitions-runtime-semantics-instantiatefunctionobject
Updated•7 years ago
|
Keywords: triage-deferred
Priority: -- → P3
Assignee | ||
Comment 1•7 years ago
|
||
Try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=e783125a34fa483b6fc10204d5be15699e793c9d
Assignee: nobody → andrebargull
Status: NEW → ASSIGNED
Assignee | ||
Comment 2•7 years ago
|
||
As far as I can tell, it doesn't really matter if the internal binding for default exports is named "*default*" or "default", because both names cannot be used for normal bindings (var, let, const, etc.). That means we can simply switch the name of the internal binding from "*default*" (the name used in the spec) to "default" without breaking anything. And now the existing code to name functions (and classes) just works (TM) and default exported functions and classes will be correctly named "default" instead of "*default*".
Additionally I've fixed another bug which was revealed when I enabled the test262 tests: We didn't implement naming anonymous functions in default export expressions <https://tc39.github.io/ecma262/#sec-exports-runtime-semantics-evaluation>.
Attachment #8930043 -
Flags: review?(jcoppeard)
Comment 3•7 years ago
|
||
Comment on attachment 8930043 [details] [diff] [review]
bug1340147.patch
Review of attachment 8930043 [details] [diff] [review]:
-----------------------------------------------------------------
Thank you for the fix, this is great.
Attachment #8930043 -
Flags: review?(jcoppeard) → review+
Assignee | ||
Comment 4•7 years ago
|
||
Try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=de0a3a0dc4e40076356c589e23860fa74f1a2e64
Keywords: checkin-needed
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/65d596a31eb9
Correctly name default function exports as "default". r=jonco
Keywords: checkin-needed
Comment 6•7 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
status-firefox59:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
Updated•6 years ago
|
status-firefox54:
affected → ---
You need to log in
before you can comment on or make changes to this bug.
Description
•