Closed Bug 1359575 Opened 7 years ago Closed 7 years ago

Report SyntaxError if GeneratorDeclaration/AsyncFunctionDeclaration is redeclared in block-scope

Categories

(Core :: JavaScript Engine, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: anba, Assigned: anba)

References

Details

Attachments

(1 file, 1 obsolete file)

|{ function* f() {} function* f() {} }| and also |{ function* f() {} function f() {} }| should report an early SyntaxError. Only duplicate FunctionDeclarations are allowed in a block scope.


B.3.3.4 Changes to Block Static Semantics: Early Errors:
https://tc39.github.io/ecma262/#sec-block-duplicates-allowed-static-semantics
Assignee: nobody → andrebargull
Status: NEW → ASSIGNED
Attached patch bug1359575.patch (obsolete) — Splinter Review
This adds a new DeclarationKind::SloppyLexicalFunction, so we can more easily differentiate between proper lexical functions and sloppy lexical functions. 

I've removed the "pc->sc()->strict()" condition in Parser::noteDeclaredName(), because DeclarationKind::SloppyLexicalFunction (and DeclarationKind::VarForAnnexBLexicalFunction) already imply non-strict mode.

I'll prepare a test262 PR for test coverage.
Attachment #8863885 - Flags: review?(shu)
Comment on attachment 8863885 [details] [diff] [review]
bug1359575.patch

Review of attachment 8863885 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good, thanks for the patch.
Attachment #8863885 - Flags: review?(shu) → review+
Attached patch bug1359575.patchSplinter Review
Updated to apply cleanly on inbound, carrying r+.
Attachment #8863885 - Attachment is obsolete: true
Attachment #8867840 - Flags: review+
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/cb4c204b5fcd
Report SyntaxError if GeneratorDeclaration/AsyncFunctionDeclaration is redeclared in block-scope. r=shu
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/cb4c204b5fcd
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: