Skip to content

Commit 5b5f6e3

Browse files
authored
fix corner case in ie (#5652)
fixes #5651
1 parent 4e4a2f8 commit 5b5f6e3

File tree

3 files changed

+53
-2
lines changed

3 files changed

+53
-2
lines changed

lib/scope.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,9 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) {
369369
// pass 3: fix up any scoping issue with IE8
370370
if (options.ie) self.walk(new TreeWalker(function(node) {
371371
if (node instanceof AST_SymbolCatch) {
372-
var scope = node.thedef.defun;
373-
if (scope.name instanceof AST_SymbolLambda && scope.name.name == node.name) {
372+
var def = node.thedef;
373+
var scope = def.defun;
374+
if (def.name != "arguments" && scope.name instanceof AST_SymbolLambda && scope.name.name == def.name) {
374375
scope = scope.parent_scope.resolve();
375376
}
376377
redefine(node, scope);

test/compress/default-values.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3044,3 +3044,28 @@ issue_5566_5: {
30443044
expect_stdout: "foo bar"
30453045
node_version: ">=6"
30463046
}
3047+
3048+
issue_5651: {
3049+
options = {
3050+
ie: true,
3051+
unused: true,
3052+
}
3053+
input: {
3054+
console.log(function arguments(a = "FAIL") {
3055+
try {} catch (arguments) {
3056+
var arguments;
3057+
}
3058+
return arguments[0];
3059+
}());
3060+
}
3061+
expect: {
3062+
console.log(function arguments(a = "FAIL") {
3063+
try {} catch (arguments) {
3064+
var arguments;
3065+
}
3066+
return arguments[0];
3067+
}());
3068+
}
3069+
expect_stdout: true
3070+
node_version: ">=6"
3071+
}

test/compress/destructured.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3844,3 +3844,28 @@ issue_5573: {
38443844
]
38453845
node_version: ">=6"
38463846
}
3847+
3848+
issue_5651: {
3849+
options = {
3850+
ie: true,
3851+
unused: true,
3852+
}
3853+
input: {
3854+
console.log(function arguments({}) {
3855+
try {} catch (arguments) {
3856+
var arguments;
3857+
}
3858+
return arguments[0];
3859+
}("PASS"));
3860+
}
3861+
expect: {
3862+
console.log(function arguments({}) {
3863+
try {} catch (arguments) {
3864+
var arguments;
3865+
}
3866+
return arguments[0];
3867+
}("PASS"));
3868+
}
3869+
expect_stdout: true
3870+
node_version: ">=6"
3871+
}

0 commit comments

Comments
 (0)