-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptES6Relates to the ES6 SpecRelates to the ES6 SpecFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
The constructs:
let v = v;
const c = c;
should error because they are uses before definition. Indeed IE gives this error.
This also applies to:
for (let v = v; ; ) { }
for (let v in v) { }
for (let v of v) { }
For the latter two in particular, look at section 13.6.4.12 in the ES6 spec:
-
Let oldEnv be the running execution context’s LexicalEnvironment.
-
If TDZnames is not an empty List, then
a. Assert: TDZnames has no duplicate entries.
b. Let TDZ be NewDeclarativeEnvironment(oldEnv).
c. For each string name in TDZnames, doi. Let status be TDZ.CreateMutableBinding(name, false). ii. Assert: status is never an abrupt completion.
d. Set the running execution context’s LexicalEnvironment to TDZ.
-
Let exprRef be the result of evaluating the production that is expr.
-
Set the running execution context’s LexicalEnvironment to oldEnv.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptES6Relates to the ES6 SpecRelates to the ES6 SpecFixedA PR has been merged for this issueA PR has been merged for this issue