diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp index 738c7c6b1b2..b134d672ca0 100644 --- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -6292,7 +6292,10 @@ Parser::assignExpr(InvokedPrediction invoked) if (!checkAndMarkAsAssignmentLhs(lhs, flavor)) return null(); + bool saved = pc->inDeclDestructuring; + pc->inDeclDestructuring = false; Node rhs = assignExpr(); + pc->inDeclDestructuring = saved; if (!rhs) return null(); diff --git a/js/src/jit-test/tests/arguments/destructuring-default-value-scope.js b/js/src/jit-test/tests/arguments/destructuring-default-value-scope.js new file mode 100644 index 00000000000..c4b16ea4dfe --- /dev/null +++ b/js/src/jit-test/tests/arguments/destructuring-default-value-scope.js @@ -0,0 +1,10 @@ +var a = 10; +function f1(a, + [b=(assertEq(a, 1), a=2, 42)], + {c:c=(assertEq(a, 2), a=3, 43)}) { + assertEq(a, 3); + assertEq(b, 42); + assertEq(c, 43); +} +f1(1, [], {}); +assertEq(a, 10);