Skip to content

Commit

Permalink
Fixes Switch Break Bug (#460)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
TobiasWienand authored Nov 11, 2024
1 parent 3f81d5a commit f6b1917
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/Fuzzilli/Compiler/Compiler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ public class JavaScriptCompiler {
// (switch blocks don't propagate an outer .loop context) so we just need to check for .loop here
if contextAnalyzer.context.contains(.loop){
emit(LoopBreak())
} else if contextAnalyzer.context.contains(.switchBlock){
} else if contextAnalyzer.context.contains(.switchCase) {
emit(SwitchBreak())
} else {
throw CompilerError.invalidNodeError("break statement outside of loop or switch")
Expand Down

0 comments on commit f6b1917

Please sign in to comment.