diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2018-06-06 17:50:56 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-06 17:50:56 +0800 |
commit | 9e19e63551907be19c8c6b5b75217d7650504436 (patch) | |
tree | 9c545c0e02d16c73a19c96f44b191af4f1eaff0e /lib/scope.js | |
parent | bce7ee5f6a28e87e2e68cd2d22b4e4280372d7bb (diff) | |
download | tracifyjs-9e19e63551907be19c8c6b5b75217d7650504436.tar.gz tracifyjs-9e19e63551907be19c8c6b5b75217d7650504436.zip |
general clean-ups (#3175)
Diffstat (limited to 'lib/scope.js')
-rw-r--r-- | lib/scope.js | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/scope.js b/lib/scope.js index fb14480f..d4b13d12 100644 --- a/lib/scope.js +++ b/lib/scope.js @@ -91,7 +91,7 @@ SymbolDef.prototype = { } }; -AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){ +AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) { options = defaults(options, { cache: null, ie8: false, @@ -101,7 +101,7 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){ var self = this; var scope = self.parent_scope = null; var defun = null; - var tw = new TreeWalker(function(node, descend){ + var tw = new TreeWalker(function(node, descend) { if (node instanceof AST_Catch) { var save_scope = scope; scope = new AST_Scope(node); @@ -162,7 +162,7 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){ // pass 2: find back references and eval self.globals = new Dictionary(); - var tw = new TreeWalker(function(node, descend){ + var tw = new TreeWalker(function(node, descend) { if (node instanceof AST_LoopControl && node.label) { node.label.thedef.references.push(node); return true; @@ -217,7 +217,7 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){ } }); -AST_Toplevel.DEFMETHOD("def_global", function(node){ +AST_Toplevel.DEFMETHOD("def_global", function(node) { var globals = this.globals, name = node.name; if (globals.has(name)) { return globals.get(name); @@ -230,7 +230,7 @@ AST_Toplevel.DEFMETHOD("def_global", function(node){ } }); -AST_Scope.DEFMETHOD("init_scope_vars", function(parent_scope){ +AST_Scope.DEFMETHOD("init_scope_vars", function(parent_scope) { this.variables = new Dictionary(); // map name to AST_SymbolVar (variables defined in this scope; includes functions) this.functions = new Dictionary(); // map name to AST_SymbolDefun (functions defined in this scope) this.uses_with = false; // will be set to true if this or some nested scope uses the `with` statement @@ -240,7 +240,7 @@ AST_Scope.DEFMETHOD("init_scope_vars", function(parent_scope){ this.cname = -1; // the current index for mangling functions/variables }); -AST_Lambda.DEFMETHOD("init_scope_vars", function(){ +AST_Lambda.DEFMETHOD("init_scope_vars", function() { AST_Scope.prototype.init_scope_vars.apply(this, arguments); this.uses_arguments = false; this.def_variable(new AST_SymbolFunarg({ @@ -270,20 +270,20 @@ AST_Symbol.DEFMETHOD("reference", function(options) { this.mark_enclosed(options); }); -AST_Scope.DEFMETHOD("find_variable", function(name){ +AST_Scope.DEFMETHOD("find_variable", function(name) { if (name instanceof AST_Symbol) name = name.name; return this.variables.get(name) || (this.parent_scope && this.parent_scope.find_variable(name)); }); -AST_Scope.DEFMETHOD("def_function", function(symbol, init){ +AST_Scope.DEFMETHOD("def_function", function(symbol, init) { var def = this.def_variable(symbol, init); if (!def.init || def.init instanceof AST_Defun) def.init = init; this.functions.set(symbol.name, def); return def; }); -AST_Scope.DEFMETHOD("def_variable", function(symbol, init){ +AST_Scope.DEFMETHOD("def_variable", function(symbol, init) { var def = this.variables.get(symbol.name); if (def) { def.orig.push(symbol); @@ -390,7 +390,7 @@ function _default_mangler_options(options) { return options; } -AST_Toplevel.DEFMETHOD("mangle_names", function(options){ +AST_Toplevel.DEFMETHOD("mangle_names", function(options) { options = _default_mangler_options(options); // We only need to mangle declaration nodes. Special logic wired @@ -407,7 +407,7 @@ AST_Toplevel.DEFMETHOD("mangle_names", function(options){ } var redefined = []; - var tw = new TreeWalker(function(node, descend){ + var tw = new TreeWalker(function(node, descend) { if (node instanceof AST_LabeledStatement) { // lname is incremented when we get to the AST_Label var save_nesting = lname; @@ -520,7 +520,7 @@ AST_Sequence.DEFMETHOD("tail_node", function() { return this.expressions[this.expressions.length - 1]; }); -AST_Toplevel.DEFMETHOD("compute_char_frequency", function(options){ +AST_Toplevel.DEFMETHOD("compute_char_frequency", function(options) { options = _default_mangler_options(options); base54.reset(); try { |