v8/test/mjsunit/regress/regress-5648.js
neis b481afd893 [parser] Fix scopes in rewriting of for-of and destructuring assignments.
The catch scopes were created with the wrong parent scope.

R=littledan@chromium.org
BUG=v8:5648

Committed: https://crrev.com/f385268d11d6da9508e481202b39f75f4b56afdd
Review-Url: https://codereview.chromium.org/2520883002
Cr-Original-Commit-Position: refs/heads/master@{#41222}
Cr-Commit-Position: refs/heads/master@{#41253}
2016-11-24 09:48:21 +00:00

36 lines
628 B
JavaScript

// 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.
var iter = {}
iter[Symbol.iterator] = () => ({
next: () => ({}),
return: () => {throw 666}
});
function* foo() {
for (let x of iter) {throw 42}
}
assertThrowsEquals(() => foo().next(), 42);
function* bar() {
let x;
{ let gaga = () => {x};
[[x]] = iter;
}
}
assertThrows(() => bar().next(), TypeError);
function baz() {
let x;
{ let gaga = () => {x};
let gugu = () => {gaga};
[[x]] = iter;
}
}
assertThrows(baz, TypeError);