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

Feature request: mark dynamic scopes a reference passes through #57

Open bakkot opened 6 years ago

bakkot commented 6 years ago

For example:

let x;
function f() {
  {
    let x;
    x; // 1
    with (o) {
      x; // 2
    }
  }
  eval(s);
  x; // 3
}

would mark 1 as passing through no dynamic scopes, would mark 2 as passing through the with, and would mark 3 as passing through the function.

michaelficarra commented 6 years ago

Can't this already be derived?

bakkot commented 6 years ago

Not trivially, especially when the dynamism comes from a sloppy direct eval.