-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deps: cherry pick 7166503 from upstream v8
Original Commit Message: Previously, any expressions inside destructuring patterns in a catch would be parsed in the surrounding scope, instead of in the catch's scope. This change fixes that by entering not only the catch scope, but also the block scope inside it. R=neis@chromium.org BUG=v8:5106, v8:5112 Review-Url: https://codereview.chromium.org/2110193002 Cr-Commit-Position: refs/heads/master@{#37415} PR-URL: #9173 Reviewed-By: jasnell - James M Snell <jasnell@gmail.com> Reviewed-By: ofrobots - Ali Ijaz Sheikh <ofrobots@google.com>
- Loading branch information
1 parent
bd7c1e7
commit 0d15ec8
Showing
2 changed files
with
51 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright 2016 the V8 project authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
function* g1() { | ||
try { | ||
throw {}; | ||
} catch ({a = class extends (yield) {}}) { | ||
} | ||
} | ||
g1().next(); // crashes without fix | ||
|
||
function* g2() { | ||
let x = function(){}; | ||
try { | ||
throw {}; | ||
} catch ({b = class extends x {}}) { | ||
} | ||
} | ||
g2().next(); // crashes without fix | ||
|
||
function* g3() { | ||
let x = 42; | ||
try { | ||
throw {}; | ||
} catch ({c = (function() { return x })()}) { | ||
} | ||
} | ||
g3().next(); // throws a ReferenceError without fix |