aboutsummaryrefslogtreecommitdiff
path: root/lib/scope.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2019-10-22 20:36:05 +0800
committerGitHub <noreply@github.com>2019-10-22 20:36:05 +0800
commit02308a7b5651ce04703fafc43887636642c5e888 (patch)
tree45c6a5ac0493bbaeb4a29897fae568e010a35c4e /lib/scope.js
parent0b3705e82f550b82bebb0c4f877ce8f41fc7495d (diff)
downloadtracifyjs-02308a7b5651ce04703fafc43887636642c5e888.tar.gz
tracifyjs-02308a7b5651ce04703fafc43887636642c5e888.zip
fix corner case in `reduce_vars` (#3510)
fixes #3509
Diffstat (limited to 'lib/scope.js')
-rw-r--r--lib/scope.js4
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/scope.js b/lib/scope.js
index 131235f6..6e33365c 100644
--- a/lib/scope.js
+++ b/lib/scope.js
@@ -292,9 +292,7 @@ AST_Scope.DEFMETHOD("def_variable", function(symbol, init) {
var def = this.variables.get(symbol.name);
if (def) {
def.orig.push(symbol);
- if (def.init && (def.scope !== symbol.scope || def.init instanceof AST_Function)) {
- def.init = init;
- }
+ if (def.init instanceof AST_Function) def.init = init;
} else {
def = new SymbolDef(this, symbol, init);
this.variables.set(symbol.name, def);