Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Commit ae2b851

Browse files
committed
tweak pause points
1 parent 9b65780 commit ae2b851

File tree

6 files changed

+31
-14
lines changed

6 files changed

+31
-14
lines changed

src/test/mochitest/browser_dbg-editor-select.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ add_task(async function() {
2626

2727
// Step through to another file and make sure it's paused in the
2828
// right place.
29+
await stepOver(dbg);
2930
await stepIn(dbg);
3031
await waitForSelectedSource(dbg, "simple2");
3132
assertPausedLocation(dbg);

src/test/mochitest/browser_dbg-sourcemaps.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,6 @@ add_task(async function() {
6161
"Original source text loaded correctly"
6262
);
6363

64-
// Test that breakpoint sliding is not attempted. The breakpoint
65-
// should not move anywhere.
66-
await addBreakpoint(dbg, entrySrc, 13);
67-
is(getBreakpoints(getState()).size, 1, "One breakpoint exists");
68-
assertBreakpointExists(dbg, entrySrc, 13);
69-
7064
// Test breaking on a breakpoint
7165
await addBreakpoint(dbg, "entry.js", 15);
7266
is(getBreakpoints(getState()).size, 2, "Two breakpoints exist");
@@ -76,6 +70,7 @@ add_task(async function() {
7670
await waitForPaused(dbg);
7771
assertPausedLocation(dbg);
7872

73+
await stepIn(dbg);
7974
await stepIn(dbg);
8075
assertPausedLocation(dbg);
8176

src/test/mochitest/browser_dbg-stepping.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ add_task(async function test() {
3333
await stepIn(dbg);
3434

3535
assertSelectedFile(dbg, "bundle.js");
36-
assertDebugLine(dbg, 42309);
36+
assertDebugLine(dbg, 42264);
3737
assertPausedLocation(dbg);
3838
});

src/workers/parser/pausePoints.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,24 @@ function formatNode(location, types) {
3636
function onEnter(node, ancestors, state) {
3737
const parent = ancestors[ancestors.length - 1];
3838

39-
if (
40-
isAssignment(node) ||
41-
isImport(node) ||
42-
isControlFlow(node) ||
43-
isReturn(node)
44-
) {
39+
if (isAssignment(node) || isImport(node) || isControlFlow(node)) {
4540
state.push(
4641
formatNode(node.loc.start, { breakpoint: true, stepOver: true })
4742
);
4843
}
4944

45+
if (isReturn(node)) {
46+
if (t.isCallExpression(node.argument)) {
47+
state.push(
48+
formatNode(node.loc.start, { breakpoint: false, stepOver: false })
49+
);
50+
} else {
51+
state.push(
52+
formatNode(node.loc.start, { breakpoint: true, stepOver: true })
53+
);
54+
}
55+
}
56+
5057
if (t.isCallExpression(node)) {
5158
state.push(
5259
formatNode(node.loc.start, {

src/workers/parser/tests/__snapshots__/pausePoints.spec.js.snap

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ else {
4343
/*bs 21*/while (x) {
4444
4545
}
46-
var /*bs 22*/a = 3;/*bs 23*/
46+
47+
/*b 22*/function ret() {
48+
/*bs 23*/console.log(\\"...\\")
49+
/* 24*/return /*bs 25*/func()
50+
/*bs 26*/}
51+
52+
53+
var /*bs 27*/a = 3;/*bs 28*/
4754
"
4855
`;

src/workers/parser/tests/fixtures/pause-points.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,11 @@ for (var i=0; i< 5; i++ ) {
4040
while (x) {
4141

4242
}
43+
44+
function ret() {
45+
console.log("...")
46+
return func()
47+
}
48+
49+
4350
var a = 3;

0 commit comments

Comments
 (0)