diff options
author | Mihai Bazon <mihai@bazon.net> | 2013-12-05 13:30:29 +0200 |
---|---|---|
committer | Mihai Bazon <mihai@bazon.net> | 2013-12-05 13:30:29 +0200 |
commit | 8f35a363d90e6521e916a8d70f3302d4adc51ae6 (patch) | |
tree | 420204f166ac3259f3d1da3ff3a265f17f21f94d /lib/scope.js | |
parent | d2190c2bf340d807a0c8595dbc2f849aa3bcc443 (diff) | |
download | tracifyjs-8f35a363d90e6521e916a8d70f3302d4adc51ae6.tar.gz tracifyjs-8f35a363d90e6521e916a8d70f3302d4adc51ae6.zip |
AST_Catch shouldn't really inherit from AST_Scope. Fix #363
I hereby acknowledge that figure_out_scope has become a mess.
Diffstat (limited to 'lib/scope.js')
-rw-r--r-- | lib/scope.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/scope.js b/lib/scope.js index ed189d49..950128d4 100644 --- a/lib/scope.js +++ b/lib/scope.js @@ -82,14 +82,20 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){ var defun = null; var nesting = 0; var tw = new TreeWalker(function(node, descend){ + if (options.screw_ie8 && node instanceof AST_Catch) { + var save_scope = scope; + scope = new AST_Scope(node); + scope.init_scope_vars(nesting); + scope.parent_scope = save_scope; + descend(); + scope = save_scope; + return true; + } if (node instanceof AST_Scope) { node.init_scope_vars(nesting); var save_scope = node.parent_scope = scope; var save_defun = defun; - if (!(node instanceof AST_Catch)) { - defun = node; - } - scope = node; + defun = scope = node; ++nesting; descend(); --nesting; scope = save_scope; defun = save_defun; |