aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-05-26 03:58:35 +0800
committerGitHub <noreply@github.com>2017-05-26 03:58:35 +0800
commitc70fb6038448cf072cfa96cee78eaa55aa99c0fa (patch)
tree8f0783721cfa3ea8140aa76bbfef43ca1ddfdef0 /lib
parent793d61499b4ab53cdfdd3b81b9faf9f36b77bae8 (diff)
downloadtracifyjs-c70fb6038448cf072cfa96cee78eaa55aa99c0fa.tar.gz
tracifyjs-c70fb6038448cf072cfa96cee78eaa55aa99c0fa.zip
clean up `lib/scope.js` (#2003)
fixes #2004
Diffstat (limited to 'lib')
-rw-r--r--lib/scope.js22
1 files changed, 4 insertions, 18 deletions
diff --git a/lib/scope.js b/lib/scope.js
index 14ffb46f..8bc96072 100644
--- a/lib/scope.js
+++ b/lib/scope.js
@@ -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;
@@ -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
@@ -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;