aboutsummaryrefslogtreecommitdiff
path: root/lib/scope.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-03-10 03:15:21 +0800
committerGitHub <noreply@github.com>2017-03-10 03:15:21 +0800
commit9e6b128374c62ee9f6238134fdc207ec9dc86284 (patch)
tree2baea0b4a78af05f080ef389e7b58f0c6c957479 /lib/scope.js
parent93cdb194f4895384b68a66736366659c39caece8 (diff)
downloadtracifyjs-9e6b128374c62ee9f6238134fdc207ec9dc86284.tar.gz
tracifyjs-9e6b128374c62ee9f6238134fdc207ec9dc86284.zip
fix catch variable reference in IE8 (#1587)
`AST_Scope.def_variable()` will overwrite `AST_Symbol.thedef`, so save a copy before calling. fixes #1586
Diffstat (limited to 'lib/scope.js')
-rw-r--r--lib/scope.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/scope.js b/lib/scope.js
index f23c8fe2..483503ee 100644
--- a/lib/scope.js
+++ b/lib/scope.js
@@ -212,9 +212,10 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){
self.walk(new TreeWalker(function(node, descend) {
if (node instanceof AST_SymbolCatch) {
var name = node.name;
+ var refs = node.thedef.references;
var scope = node.thedef.scope.parent_scope;
var def = scope.find_variable(name) || self.globals.get(name) || scope.def_variable(node);
- node.thedef.references.forEach(function(ref) {
+ refs.forEach(function(ref) {
ref.thedef = def;
ref.reference(options);
});