Skip to content

Commit

Permalink
Fixes some nits
Browse files Browse the repository at this point in the history
- Improved clarity in CompilerError message
- Improved brevity of tryStatement code because IdentifierParameter is the only allowed parameter
- None case is in parameter type switch statement
  • Loading branch information
TobiasWienand committed Oct 21, 2024
1 parent 2a0816b commit 6e8fde4
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions Sources/Fuzzilli/Compiler/Compiler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -468,14 +468,10 @@ public class JavaScriptCompiler {
try enterNewScope {
let beginCatch = emit(BeginCatch())
if tryStatement.catch.hasParameter {
let parameter = tryStatement.catch.parameter
switch parameter.parameter {
case .identifierParameter(let identifier):
map(identifier.name, to: beginCatch.innerOutput)

default:
throw CompilerError.unsupportedFeatureError("Unsupported parameter type")
guard case let .identifierParameter(identifier) = tryStatement.catch.parameter.parameter else {
throw CompilerError.unsupportedFeatureError("Only identifier parameters are supported in catch blocks")
}
map(identifier.name, to: beginCatch.innerOutput)
}
for statement in tryStatement.catch.body {
try compileStatement(statement)
Expand Down Expand Up @@ -1095,7 +1091,7 @@ public class JavaScriptCompiler {
flatParameters.append(element.name)
expectedVariableCount += 1
}
default:
case .none:
break
}
}
Expand Down

0 comments on commit 6e8fde4

Please sign in to comment.