mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:07:45 +00:00
LibJS: Implement basic execution of "switch" statements
The "break" keyword now unwinds to the nearest ScopeType::Breakable. There's no support for break labels yet, but we'll get there too.
This commit is contained in:
parent
1923051c5b
commit
2285f84596
6 changed files with 57 additions and 2 deletions
10
Libraries/LibJS/Tests/switch-basic-2.js
Normal file
10
Libraries/LibJS/Tests/switch-basic-2.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
var a = "foo";
|
||||
|
||||
switch (a + "bar") {
|
||||
case 1:
|
||||
break;
|
||||
case "foobar":
|
||||
case 2:
|
||||
console.log("PASS");
|
||||
break;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue