Closed
Bug 1340148
Opened 8 years ago
Closed 7 years ago
Redeclaration of top-level functions should throw SyntaxError in modules
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla54
Tracking | Status | |
---|---|---|
firefox54 | --- | fixed |
People
(Reporter: anba, Assigned: anba)
References
Details
Attachments
(1 file, 1 obsolete file)
(deleted),
patch
|
anba
:
review+
|
Details | Diff | Splinter Review |
Test case: --- function f() {} var f; --- Expected: Throws SyntaxError Actual: No error
Assignee | ||
Comment 1•8 years ago
|
||
Adding a new DeclarationKind entry seems to be the easiest way to handle this early error restriction.
Assignee: nobody → andrebargull
Status: NEW → ASSIGNED
Attachment #8841099 -
Flags: review?(jcoppeard)
Assignee | ||
Comment 2•8 years ago
|
||
Spec bits: https://tc39.github.io/ecma262/#sec-module-semantics-static-semantics-early-errors 15.2.1.1 Static Semantics: Early Errors - It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList contains any duplicate entries. https://tc39.github.io/ecma262/#sec-module-semantics-static-semantics-lexicallydeclarednames 15.2.1.11 Static Semantics: LexicallyDeclaredNames - ModuleItem:StatementListItem Return LexicallyDeclaredNames of StatementListItem. (Also NOTE 2 in 15.2.1.11) https://tc39.github.io/ecma262/#sec-block-static-semantics-lexicallydeclarednames 13.2.5 Static Semantics: LexicallyDeclaredNames - StatementListItem:Declaration Return the BoundNames of Declaration.
Comment 3•7 years ago
|
||
Comment on attachment 8841099 [details] [diff] [review] bug1340148.patch Review of attachment 8841099 [details] [diff] [review]: ----------------------------------------------------------------- I love the exhaustive test.
Attachment #8841099 -
Flags: review?(jcoppeard) → review+
Assignee | ||
Comment 4•7 years ago
|
||
Updated patch to apply cleanly on inbound, carrying r+ from jonco.
Attachment #8841099 -
Attachment is obsolete: true
Attachment #8841544 -
Flags: review+
Assignee | ||
Comment 5•7 years ago
|
||
Try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=1385bc84ccb5564640b4359fc7816a4b924e516e
Keywords: checkin-needed
Pushed by ryanvm@gmail.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/1bc4a653e92e Disallow function redeclarations at module top level. r=jonco
Keywords: checkin-needed
Comment 7•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/1bc4a653e92e
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
You need to log in
before you can comment on or make changes to this bug.
Description
•