-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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.
- Loading branch information
1 parent
2230c26
commit 7e6574b
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 |