Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(do-expr): SwitchStatement with IfStatement cases (#11728)
* test(do-expr): condition before break * test(do-expr): labeled break * fix(do-expr): add check for break in BlockStatement * fix(do-expr): add LabeledStatement case for getCompletionRecords * test(do-expr): rename condition before break to condition before expression * revert(do-expr): undo remove break for do switch * revert(do-expr): undo remove labeled break * test(do-expr): add condition before break * test(do-expr): update condition before break * test(do-expr): remove labeled break * fix(do-expr): add tree search in findBreak * fix(do-expr): ignore isFunction case in findBreak
- Loading branch information
Showing
6 changed files
with
78 additions
and
14 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
...sal-do-expressions/test/fixtures/do-expression-switch-case/condition-before-break/exec.js
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,10 @@ | ||
const x = (n) => do { | ||
switch (n) { | ||
case 0: | ||
if (true) { | ||
break; | ||
} | ||
} | ||
} | ||
|
||
expect(x(0)).toBe(undefined); |
8 changes: 8 additions & 0 deletions
8
...al-do-expressions/test/fixtures/do-expression-switch-case/condition-before-break/input.js
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,8 @@ | ||
const x = (n) => do { | ||
switch (n) { | ||
case 0: | ||
if (true) { | ||
break; | ||
} | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...l-do-expressions/test/fixtures/do-expression-switch-case/condition-before-break/output.js
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,6 @@ | ||
const x = n => function () { | ||
switch (n) { | ||
case 0: | ||
if (true) return void 0; | ||
} | ||
}(); |
10 changes: 10 additions & 0 deletions
10
...-expressions/test/fixtures/do-expression-switch-case/condition-before-expression/input.js
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,10 @@ | ||
const x = (n) => do { | ||
switch (n) { | ||
case 0: | ||
if (true) { | ||
'out'; | ||
break; | ||
} | ||
|
||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...expressions/test/fixtures/do-expression-switch-case/condition-before-expression/output.js
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,9 @@ | ||
const x = n => function () { | ||
switch (n) { | ||
case 0: | ||
if (true) { | ||
return 'out'; | ||
} | ||
|
||
} | ||
}(); |
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