diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-01-26 19:18:28 +0800 |
---|---|---|
committer | Richard van Velzen <rvanvelzen1@gmail.com> | 2017-01-26 12:18:28 +0100 |
commit | 1eaa211e0932105439d98d4f03a981f157f0a77c (patch) | |
tree | 3167d7068dbf72992dc9df6b6fcabdf9e3b87962 /lib | |
parent | 0610c020b1544820be9898a285ab6c9066490552 (diff) | |
download | tracifyjs-1eaa211e0932105439d98d4f03a981f157f0a77c.tar.gz tracifyjs-1eaa211e0932105439d98d4f03a981f157f0a77c.zip |
fix mangling collision with keep_fnames (#1431)
* fix mangling collision with keep_fnames
fixes #1423
* pass mangle options to figure_out_scope()
bring command-line in line with minify()
Diffstat (limited to 'lib')
-rw-r--r-- | lib/scope.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/scope.js b/lib/scope.js index ae792a0a..55d1eff1 100644 --- a/lib/scope.js +++ b/lib/scope.js @@ -233,7 +233,7 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){ if (isModified(node, 0)) { sym.modified = true; } - node.reference(); + node.reference(options); return true; } }); @@ -264,13 +264,18 @@ AST_Lambda.DEFMETHOD("init_scope_vars", function(){ this.variables.set(symbol.name, def); }); -AST_SymbolRef.DEFMETHOD("reference", function() { +AST_SymbolRef.DEFMETHOD("reference", function(options) { var def = this.definition(); def.references.push(this); var s = this.scope; while (s) { push_uniq(s.enclosed, def); if (s === def.scope) break; + if (options.keep_fnames) { + s.variables.each(function(d) { + push_uniq(def.scope.enclosed, d); + }); + } s = s.parent_scope; } this.frame = this.scope.nesting - def.scope.nesting; @@ -338,11 +343,6 @@ AST_Function.DEFMETHOD("next_mangled", function(options, def){ } }); -AST_Scope.DEFMETHOD("references", function(sym){ - if (sym instanceof AST_Symbol) sym = sym.definition(); - return this.enclosed.indexOf(sym) < 0 ? null : sym; -}); - AST_Symbol.DEFMETHOD("unmangleable", function(options){ return this.definition().unmangleable(options); }); |