retrofit try-catch-finally as block-scoped (#4178)
- support optional catch binding
This commit is contained in:
@@ -4457,9 +4457,11 @@ merge(Compressor.prototype, {
|
||||
walk_body(node, tw);
|
||||
pop();
|
||||
if (node.bcatch) {
|
||||
var def = node.bcatch.argname.definition();
|
||||
references[def.id] = false;
|
||||
if (def = def.redefined()) references[def.id] = false;
|
||||
if (node.bcatch.argname) {
|
||||
var def = node.bcatch.argname.definition();
|
||||
references[def.id] = false;
|
||||
if (def = def.redefined()) references[def.id] = false;
|
||||
}
|
||||
push();
|
||||
if (node.bfinally) segment.block = node.bcatch;
|
||||
walk_body(node.bcatch, tw);
|
||||
@@ -7055,7 +7057,7 @@ merge(Compressor.prototype, {
|
||||
child = scope;
|
||||
scope = compressor.parent(++level);
|
||||
if (scope instanceof AST_Catch) {
|
||||
catches[scope.argname.name] = true;
|
||||
if (scope.argname) catches[scope.argname.name] = true;
|
||||
} else if (scope instanceof AST_DWLoop) {
|
||||
in_loop = [];
|
||||
} else if (scope instanceof AST_For) {
|
||||
|
||||
Reference in New Issue
Block a user