v8/test/inspector/debugger/array-destructuring-expected.txt
Benedikt Meurer c45a214cb5 [debug] Remove confusing destructuring statement positions.
This change removes the confusing statement positions that were
previously emitted for every binding identifier within both array
and object destructurings. These statement positions were reported as
breakable positions to the debugger front-end, and during stepping, the
debugger would also stop on them. This is confusing and very different
from how other expressions work (we don't emit statement positions
within expressions normally).

Instead we emit expression positions for the binding identifiers, which
are used to construct the source positions for stack traces. As a drive
by we also add the missing position (and test cases) for sub-patterns.

In particular this aligns the stepping and breakpoint behavior around
destructuring expressions with that of Firefox DevTools.

We also remove the original test cases, introduced with
https://codereview.chromium.org/1542813003 and
https://codereview.chromium.org/1533313002, which were written as
debugger tests, with new inspector tests that also ensure that the
call positions are correct.

Fixed: chromium:1368444
Bug: v8:811
Doc: http://go/chrome-devtools:destructuring-breakpoints-design
Change-Id: I4d53ad059b5eede73abd01d9bc9fdf8263c55c9d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3916453
Reviewed-by: Kim-Anh Tran <kimanh@chromium.org>
Commit-Queue: Kim-Anh Tran <kimanh@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83455}
2022-09-27 14:19:24 +00:00

173 lines
3.8 KiB
Plaintext

Tests breakable locations in array destructuring.
Running test: testBreakLocations
function testFunction() {
var [a, b, c = 4] = |C|generator1();
|_|[[a, b], c] = |C|generator2();
|_|[a, ...b] = |C|generator1();
|R|}
function generator1() {
|_|return {
[Symbol.iterator]() {
const it = |_|[1, 2].|C|values();
|_|return {next() { |_|return it.|C|next();|R| }};|R|
}
};|R|
}
function generator2() {
|_|return {
[Symbol.iterator]() {
const it = |_|[|C|generator1(), 3].|C|values();
|_|return {next() { |_|return it.|C|next();|R| }};|R|
}
};|R|
}
|R|
Running test: testStepping
Execution paused in testFunction:
function testFunction() {
var [a, b, c = 4] = #generator1();
[[a, b], c] = generator2();
Execution paused in generator1:
function generator1() {
#return {
[Symbol.iterator]() {
Called from testFunction:
function testFunction() {
var [a, b, c = 4] = #generator1();
[[a, b], c] = generator2();
Execution paused in [Symbol.iterator]:
[Symbol.iterator]() {
const it = #[1, 2].values();
return {next() { return it.next(); }};
Called from testFunction:
function testFunction() {
var [a, b, c = 4] = #generator1();
[[a, b], c] = generator2();
Execution paused in next:
const it = [1, 2].values();
return {next() { #return it.next(); }};
}
Called from testFunction:
function testFunction() {
var [#a, b, c = 4] = generator1();
[[a, b], c] = generator2();
Execution paused in testFunction:
var [a, b, c = 4] = generator1();
#[[a, b], c] = generator2();
[a, ...b] = generator1();
Execution paused in generator2:
function generator2() {
#return {
[Symbol.iterator]() {
Called from testFunction:
var [a, b, c = 4] = generator1();
[[a, b], c] = #generator2();
[a, ...b] = generator1();
Execution paused in [Symbol.iterator]:
[Symbol.iterator]() {
const it = #[generator1(), 3].values();
return {next() { return it.next(); }};
Called from testFunction:
var [a, b, c = 4] = generator1();
[[a, b], c] #= generator2();
[a, ...b] = generator1();
Execution paused in next:
const it = [generator1(), 3].values();
return {next() { #return it.next(); }};
}
Called from testFunction:
var [a, b, c = 4] = generator1();
[#[a, b], c] = generator2();
[a, ...b] = generator1();
Execution paused in [Symbol.iterator]:
[Symbol.iterator]() {
const it = #[1, 2].values();
return {next() { return it.next(); }};
Called from testFunction:
var [a, b, c = 4] = generator1();
[#[a, b], c] = generator2();
[a, ...b] = generator1();
Execution paused in next:
const it = [1, 2].values();
return {next() { #return it.next(); }};
}
Called from testFunction:
var [a, b, c = 4] = generator1();
[[#a, b], c] = generator2();
[a, ...b] = generator1();
Execution paused in next:
const it = [generator1(), 3].values();
return {next() { #return it.next(); }};
}
Called from testFunction:
var [a, b, c = 4] = generator1();
[[a, b], #c] = generator2();
[a, ...b] = generator1();
Execution paused in testFunction:
[[a, b], c] = generator2();
#[a, ...b] = generator1();
}
Execution paused in generator1:
function generator1() {
#return {
[Symbol.iterator]() {
Called from testFunction:
[[a, b], c] = generator2();
[a, ...b] = #generator1();
}
Execution paused in [Symbol.iterator]:
[Symbol.iterator]() {
const it = #[1, 2].values();
return {next() { return it.next(); }};
Called from testFunction:
[[a, b], c] = generator2();
[a, ...b] #= generator1();
}
Execution paused in next:
const it = [1, 2].values();
return {next() { #return it.next(); }};
}
Called from testFunction:
[[a, b], c] = generator2();
[#a, ...b] = generator1();
}
Execution paused in testFunction:
[a, ...b] = generator1();
#}
Resuming and finishing...