mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:48:12 +00:00
LibJS: Defer execution of switch default clause until after case clauses
When we encounter a default clause in a switch statement, we should not execute it immediately, instead we need to wait until all case clauses have been executed as a matching case clause can break from the switch/case. The code is nowhere close to the spec, so instead of fixing it properly I just made it slightly worse, but correct. Needs a complete refactor at some point.
This commit is contained in:
parent
a248ec63e3
commit
ababcc5725
2 changed files with 41 additions and 12 deletions
|
@ -0,0 +1,9 @@
|
|||
test("default clause before matching case clause", () => {
|
||||
switch (1 + 2) {
|
||||
default:
|
||||
expect().fail();
|
||||
break;
|
||||
case 3:
|
||||
return;
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue