archives

« Bugzilla Issues Index

#4093 — LexicallyDeclaredNames of BlockStatement should be empty


LexicallyDeclaredNames of BlockStatement is not undefined. Applying " chain productions " rule in 5.2, it derives from the LexicallyDeclaredNames of the StatementList.

Considering an example:

function x() {
let a;
{
let a;
}
}


The LexicallyDeclaredNames of the BlockStatement is { "a" } and therefore there is a duplicated name "a" in the LexicallyDeclaredNames of the FunctionBody. In other words, block scoping does not exists.


Re-read 13.1.5 Static Semantics: LexicallyDeclaredNames and LexicallyDeclaredNames is cleared at each statement except LabelledStatement. Thus solves the issue.