[Wasm] Minor: move buildUnreachable* helpers to more specific module
This commit is contained in:
+14
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.backend.wasm.ir2wasm
|
||||
import org.jetbrains.kotlin.ir.IrElement
|
||||
import org.jetbrains.kotlin.ir.IrFileEntry
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
import org.jetbrains.kotlin.wasm.ir.WasmExpressionBuilder
|
||||
import org.jetbrains.kotlin.wasm.ir.source.location.SourceLocation
|
||||
|
||||
fun IrElement.getSourceLocation(fileEntry: IrFileEntry?): SourceLocation {
|
||||
@@ -21,3 +22,16 @@ fun IrElement.getSourceLocation(fileEntry: IrFileEntry?): SourceLocation {
|
||||
|
||||
return SourceLocation.Location(path, startLine, startColumn)
|
||||
}
|
||||
|
||||
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."
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -206,16 +206,3 @@ 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