shapesecurity / shift-scope-js

scope analyser for the Shift AST
http://shift-ast.org/scope.html
Apache License 2.0
11 stars 6 forks source link

Parameters do not block B.3.3 hoisting #32

Closed bakkot closed 7 years ago

bakkot commented 8 years ago

Consider

function a(b) {
  {
    function b(){}
  }
}

The conditions for hoisting are "If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for func and F is not an element of BoundNames of argumentsList,"

As such, the nested b should not create a var-scoped declaration. It currently does.

(I missed the clause about "not an element of BoundNames of argumentsList" when I was reading it, I guess.)