Closed Bug 1102522 Opened 11 years ago Closed 9 years ago

Make redeclaration errors for lexical bindings ES6-compliant

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: shu, Unassigned)

References

Details

According to ES6 13.1.1 [1], if the same identifier appears both in VarDeclaredNames and LexicallyDeclaredNames, an early error is raised. AFAICT, VarDeclaredNames does not take hoisting into account, so the following is an early error even though the 'let' actually shadows the 'var': function() { { var x; let x; } } Currently we don't do the right thing here. If a lexical declaration appears after a 'var' declaration in a scope that in fact hoists the 'var' declaration out of the scope (like above), a TDZ instead of an early error is raised. In the case of consts, we will raise a assign-to-const error instead of the early redecl error. [1] http://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-early-errors
Fixed by bug 1263355.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.