reduce this in block scopes (#2526)

fixes #2455
This commit is contained in:
Alex Lam S.L
2017-11-28 22:54:21 +08:00
committed by GitHub
parent 37cbd7080c
commit 62d2817d6c
4 changed files with 24 additions and 8 deletions

View File

@@ -183,11 +183,7 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){
// scope when we encounter the AST_Defun node (which is
// instanceof AST_Scope) but we get to the symbol a bit
// later.
var parent_lambda = defun.parent_scope;
while (parent_lambda.is_block_scope()) {
parent_lambda = parent_lambda.parent_scope;
}
mark_export((node.scope = parent_lambda).def_function(node), 1);
mark_export((node.scope = defun.parent_scope.get_defun_scope()).def_function(node), 1);
}
else if (node instanceof AST_SymbolClass) {
mark_export(defun.def_variable(node), 1);