c45a214cb5
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}
125 lines
2.3 KiB
Plaintext
125 lines
2.3 KiB
Plaintext
Tests breakable locations in object destructuring.
|
|
|
|
Running test: testBreakLocations
|
|
|
|
function testFunction() {
|
|
var {a, b, c = 4} = |_|obj1;
|
|
|_|({d: {a, b}, c} = obj2);
|
|
|_|({a, ...b} = obj1);
|
|
|R|}
|
|
|
|
var obj1 = |_|{
|
|
get a() { |_|return 1;|R| },
|
|
get b() { |_|return 2;|R| },
|
|
};
|
|
|
|
var obj2 = |_|{
|
|
get c() { |_|return 3;|R| },
|
|
get d() { |_|return obj1;|R| },
|
|
};
|
|
|R|
|
|
|
|
|
|
Running test: testStepping
|
|
Execution paused in testFunction:
|
|
function testFunction() {
|
|
var {a, b, c = 4} = #obj1;
|
|
({d: {a, b}, c} = obj2);
|
|
|
|
Execution paused in get a:
|
|
var obj1 = {
|
|
get a() { #return 1; },
|
|
get b() { return 2; },
|
|
|
|
Called from testFunction:
|
|
function testFunction() {
|
|
var {#a, b, c = 4} = obj1;
|
|
({d: {a, b}, c} = obj2);
|
|
|
|
Execution paused in get b:
|
|
get a() { return 1; },
|
|
get b() { #return 2; },
|
|
};
|
|
|
|
Called from testFunction:
|
|
function testFunction() {
|
|
var {a, #b, c = 4} = obj1;
|
|
({d: {a, b}, c} = obj2);
|
|
|
|
Execution paused in testFunction:
|
|
var {a, b, c = 4} = obj1;
|
|
#({d: {a, b}, c} = obj2);
|
|
({a, ...b} = obj1);
|
|
|
|
Execution paused in get d:
|
|
get c() { return 3; },
|
|
get d() { #return obj1; },
|
|
};
|
|
|
|
Called from testFunction:
|
|
var {a, b, c = 4} = obj1;
|
|
({d: #{a, b}, c} = obj2);
|
|
({a, ...b} = obj1);
|
|
|
|
Execution paused in get a:
|
|
var obj1 = {
|
|
get a() { #return 1; },
|
|
get b() { return 2; },
|
|
|
|
Called from testFunction:
|
|
var {a, b, c = 4} = obj1;
|
|
({d: {#a, b}, c} = obj2);
|
|
({a, ...b} = obj1);
|
|
|
|
Execution paused in get b:
|
|
get a() { return 1; },
|
|
get b() { #return 2; },
|
|
};
|
|
|
|
Called from testFunction:
|
|
var {a, b, c = 4} = obj1;
|
|
({d: {a, #b}, c} = obj2);
|
|
({a, ...b} = obj1);
|
|
|
|
Execution paused in get c:
|
|
var obj2 = {
|
|
get c() { #return 3; },
|
|
get d() { return obj1; },
|
|
|
|
Called from testFunction:
|
|
var {a, b, c = 4} = obj1;
|
|
({d: {a, b}, #c} = obj2);
|
|
({a, ...b} = obj1);
|
|
|
|
Execution paused in testFunction:
|
|
({d: {a, b}, c} = obj2);
|
|
#({a, ...b} = obj1);
|
|
}
|
|
|
|
Execution paused in get a:
|
|
var obj1 = {
|
|
get a() { #return 1; },
|
|
get b() { return 2; },
|
|
|
|
Called from testFunction:
|
|
({d: {a, b}, c} = obj2);
|
|
({#a, ...b} = obj1);
|
|
}
|
|
|
|
Execution paused in get b:
|
|
get a() { return 1; },
|
|
get b() { #return 2; },
|
|
};
|
|
|
|
Called from testFunction:
|
|
({d: {a, b}, c} = obj2);
|
|
({a, ...#b} = obj1);
|
|
}
|
|
|
|
Execution paused in testFunction:
|
|
({a, ...b} = obj1);
|
|
#}
|
|
|
|
|
|
Resuming and finishing...
|