From 1807044d2f3146662e5c52caa47646b5079611d5 Mon Sep 17 00:00:00 2001 From: Tobias Wienand Date: Thu, 22 Aug 2024 10:47:46 +0200 Subject: [PATCH] Refactoring: Comments and unnecessary breaks --- Sources/Fuzzilli/Compiler/Compiler.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Fuzzilli/Compiler/Compiler.swift b/Sources/Fuzzilli/Compiler/Compiler.swift index 114d96b1..dedd822a 100644 --- a/Sources/Fuzzilli/Compiler/Compiler.swift +++ b/Sources/Fuzzilli/Compiler/Compiler.swift @@ -444,12 +444,12 @@ public class JavaScriptCompiler { emit(EndForOfLoop()) case .breakStatement: + // If we're in both .loop and .switch context, then the loop must be the most recent context + // (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()) - break } else if contextAnalyzer.context.contains(.switchBlock){ emit(SwitchBreak()) - break } else { throw CompilerError.invalidNodeError("break statement outside of loop or switch") }