Skip to content

Commit

Permalink
clean up lib/scope.js (#2003)
Browse files Browse the repository at this point in the history
fixes #2004
  • Loading branch information
alexlamsl authored May 25, 2017
1 parent 793d614 commit c70fb60
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions lib/scope.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,16 +183,8 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){
self.walk(tw);

// pass 2: find back references and eval
var func = null;
var globals = self.globals = new Dictionary();
self.globals = new Dictionary();
var tw = new TreeWalker(function(node, descend){
if (node instanceof AST_Lambda) {
var prev_func = func;
func = node;
descend();
func = prev_func;
return true;
}
if (node instanceof AST_LoopControl && node.label) {
node.label.thedef.references.push(node);
return true;
Expand Down Expand Up @@ -361,9 +353,7 @@ AST_Symbol.DEFMETHOD("unmangleable", function(options){
});

// labels are always mangleable
AST_Label.DEFMETHOD("unmangleable", function(){
return false;
});
AST_Label.DEFMETHOD("unmangleable", return_false);

AST_Symbol.DEFMETHOD("unreferenced", function(){
return this.definition().references.length == 0
Expand All @@ -374,13 +364,9 @@ AST_Symbol.DEFMETHOD("undeclared", function(){
return this.definition().undeclared;
});

AST_LabelRef.DEFMETHOD("undeclared", function(){
return false;
});
AST_LabelRef.DEFMETHOD("undeclared", return_false);

AST_Label.DEFMETHOD("undeclared", function(){
return false;
});
AST_Label.DEFMETHOD("undeclared", return_false);

AST_Symbol.DEFMETHOD("definition", function(){
return this.thedef;
Expand Down

0 comments on commit c70fb60

Please sign in to comment.