retrofit try-catch-finally as block-scoped (#4178)
- support optional catch binding
This commit is contained in:
10
lib/scope.js
10
lib/scope.js
@@ -114,6 +114,14 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) {
|
||||
});
|
||||
return true;
|
||||
}
|
||||
if (node instanceof AST_Try) {
|
||||
walk_scope(function() {
|
||||
walk_body(node, tw);
|
||||
});
|
||||
if (node.bcatch) node.bcatch.walk(tw);
|
||||
if (node.bfinally) node.bfinally.walk(tw);
|
||||
return true;
|
||||
}
|
||||
if (node instanceof AST_BlockScope) {
|
||||
walk_scope(descend);
|
||||
return true;
|
||||
@@ -468,7 +476,7 @@ AST_Toplevel.DEFMETHOD("mangle_names", function(options) {
|
||||
node.mangled_name = name;
|
||||
return true;
|
||||
}
|
||||
if (!options.ie8 && node instanceof AST_Catch) {
|
||||
if (!options.ie8 && node instanceof AST_Catch && node.argname) {
|
||||
var def = node.argname.definition();
|
||||
var redef = defer_redef(def, node.argname);
|
||||
descend();
|
||||
|
||||
Reference in New Issue
Block a user