Skip to content

Commit f6b1917

Browse files
Fixes Switch Break Bug (#460)
Bug can be seen when trying to compile Tests/FuzzilliTests/CompilerTests/switch_statements.js, which fails because "break statement outside of loop or switch", even though it isn't. This happens because breaks are expected in the switch cases, rather than the switch block.
1 parent 3f81d5a commit f6b1917

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/Fuzzilli/Compiler/Compiler.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ public class JavaScriptCompiler {
448448
// (switch blocks don't propagate an outer .loop context) so we just need to check for .loop here
449449
if contextAnalyzer.context.contains(.loop){
450450
emit(LoopBreak())
451-
} else if contextAnalyzer.context.contains(.switchBlock){
451+
} else if contextAnalyzer.context.contains(.switchCase) {
452452
emit(SwitchBreak())
453453
} else {
454454
throw CompilerError.invalidNodeError("break statement outside of loop or switch")

0 commit comments

Comments
 (0)