Closed
Bug 1231647
Opened 9 years ago
Closed 9 years ago
Duplicate export check doesn't work for const and let bindings
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla46
Tracking | Status | |
---|---|---|
firefox46 | --- | fixed |
People
(Reporter: jonco, Assigned: jonco)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
(deleted),
patch
|
shu
:
review+
|
Details | Diff | Splinter Review |
These are not currently added to the exportedNames list.
Let/const bindings will generate a SyntaxError if they duplicate the name of an existing binding, but this is not enough to catch all errors.
Assignee | ||
Comment 1•9 years ago
|
||
Patch to add exported let/const names to the exported names list and add tests.
Attachment #8697245 -
Flags: review?(shu)
Comment 2•9 years ago
|
||
Comment on attachment 8697245 [details] [diff] [review]
check-duplicate-export-let
Review of attachment 8697245 [details] [diff] [review]:
-----------------------------------------------------------------
::: js/src/frontend/Parser.cpp
@@ +5052,5 @@
> +template<>
> +bool
> +Parser<SyntaxParseHandler>::addExportNamesForDeclaration(Node node)
> +{
> + JS_ALWAYS_FALSE(abortIfSyntaxParser());
MOZ_ALWAYS_FALSE if you would
@@ +5276,5 @@
> kid = lexicalDeclaration(YieldIsName, tt == TOK_CONST);
> if (!kid)
> return null();
> + if (!addExportNamesForDeclaration(kid))
> + return null();
Ah, good catch.
::: js/src/jit-test/tests/modules/duplicate-exports.js
@@ +30,5 @@
> +testSyntaxError("export let x, y, z; export let y;");
> +testSyntaxError("export const v = 0; export const v = 0;");
> +testSyntaxError("export const x = 0, y = 0, z = 0; export const y = 0;");
> +testSyntaxError("export var v; export let v;");
> +testSyntaxError("export var v; export const v = 0;");
Could you add one more case testing |export let v; export const v;|?
Attachment #8697245 -
Flags: review?(shu) → review+
Comment 4•9 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox46:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
You need to log in
before you can comment on or make changes to this bug.
Description
•