[Wasm] Require location for buildUnreachable and fix all usages
This commit is contained in:
@@ -36,8 +36,8 @@ abstract class WasmExpressionBuilder {
|
||||
buildInstr(WasmOp.I32_CONST, location, WasmImmediate.SymbolI32(value))
|
||||
}
|
||||
|
||||
fun buildUnreachable() {
|
||||
buildInstr(WasmOp.UNREACHABLE)
|
||||
fun buildUnreachable(location: SourceLocation) {
|
||||
buildInstr(WasmOp.UNREACHABLE, location)
|
||||
}
|
||||
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
@@ -191,3 +191,16 @@ abstract class WasmExpressionBuilder {
|
||||
buildInstr(WasmOp.PSEUDO_COMMENT_GROUP_END)
|
||||
}
|
||||
}
|
||||
|
||||
fun WasmExpressionBuilder.buildUnreachableForVerifier() {
|
||||
buildUnreachable(SourceLocation.NoLocation("This instruction should never be reached, but required for wasm verifier"))
|
||||
}
|
||||
|
||||
fun WasmExpressionBuilder.buildUnreachableAfterNothingType() {
|
||||
buildUnreachable(
|
||||
SourceLocation.NoLocation(
|
||||
"The unreachable instruction after an expression with Nothing type to make sure that " +
|
||||
"execution doesn't come here (or it fails fast if so). It also might be required for wasm verifier."
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user