diff options
author | alexlamsl <alexlamsl@gmail.com> | 2017-02-18 19:00:54 +0800 |
---|---|---|
committer | alexlamsl <alexlamsl@gmail.com> | 2017-02-18 19:00:54 +0800 |
commit | fa668a28b47e06d838659d4e0910460c84ca3a61 (patch) | |
tree | 602230f955f901780f5e0577b76706d72bf8a832 /lib/scope.js | |
parent | 686a496b1c8c3762768c0da6ef98b37167d4d4ba (diff) | |
download | tracifyjs-fa668a28b47e06d838659d4e0910460c84ca3a61.tar.gz tracifyjs-fa668a28b47e06d838659d4e0910460c84ca3a61.zip |
fix corner case in keep_fnames
happens when inner function:
- just below top level
- not referenced
- `unused` is disabled
closes #1445
Diffstat (limited to 'lib/scope.js')
-rw-r--r-- | lib/scope.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/scope.js b/lib/scope.js index 0fe8d83a..d5cadd34 100644 --- a/lib/scope.js +++ b/lib/scope.js @@ -268,12 +268,12 @@ AST_SymbolRef.DEFMETHOD("reference", function(options) { 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) { + s.functions.each(function(d) { push_uniq(def.scope.enclosed, d); }); } + if (s === def.scope) break; s = s.parent_scope; } }); |