extend collapse_vars to let and const (#2252)

fixes #2250
This commit is contained in:
Alex Lam S.L
2017-07-25 22:07:21 +08:00
committed by GitHub
parent 69861824b5
commit d3df2f985d
4 changed files with 71 additions and 2 deletions

View File

@@ -116,7 +116,7 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){
var tw = new TreeWalker(function(node, descend){
if (node.is_block_scope()) {
var save_scope = scope;
scope = new AST_Scope(node);
node.block_scope = scope = new AST_Scope(node);
scope.init_scope_vars(save_scope);
if (!(node instanceof AST_Scope)) {
scope.uses_with = save_scope.uses_with;