[Wasm] Require location for buildConstI64 and fix all usages
This commit is contained in:
+2
-2
@@ -477,7 +477,7 @@ fun generateDefaultInitializerForType(type: WasmType, g: WasmExpressionBuilder)
|
|||||||
withNoLocation("Default initializer, usually don't require location") {
|
withNoLocation("Default initializer, usually don't require location") {
|
||||||
when (type) {
|
when (type) {
|
||||||
WasmI32 -> g.buildConstI32(0, location)
|
WasmI32 -> g.buildConstI32(0, location)
|
||||||
WasmI64 -> g.buildConstI64(0)
|
WasmI64 -> g.buildConstI64(0, location)
|
||||||
WasmF32 -> g.buildConstF32(0f)
|
WasmF32 -> g.buildConstF32(0f)
|
||||||
WasmF64 -> g.buildConstF64(0.0)
|
WasmF64 -> g.buildConstF64(0.0)
|
||||||
is WasmRefNullType -> g.buildRefNull(type.heapType)
|
is WasmRefNullType -> g.buildRefNull(type.heapType)
|
||||||
@@ -510,7 +510,7 @@ fun generateConstExpression(expression: IrConst<*>, body: WasmExpressionBuilder,
|
|||||||
is IrConstKind.Byte -> body.buildConstI32(kind.valueOf(expression).toInt(), location)
|
is IrConstKind.Byte -> body.buildConstI32(kind.valueOf(expression).toInt(), location)
|
||||||
is IrConstKind.Short -> body.buildConstI32(kind.valueOf(expression).toInt(), location)
|
is IrConstKind.Short -> body.buildConstI32(kind.valueOf(expression).toInt(), location)
|
||||||
is IrConstKind.Int -> body.buildConstI32(kind.valueOf(expression), location)
|
is IrConstKind.Int -> body.buildConstI32(kind.valueOf(expression), location)
|
||||||
is IrConstKind.Long -> body.buildConstI64(kind.valueOf(expression))
|
is IrConstKind.Long -> body.buildConstI64(kind.valueOf(expression), location)
|
||||||
is IrConstKind.Char -> body.buildConstI32(kind.valueOf(expression).code, location)
|
is IrConstKind.Char -> body.buildConstI32(kind.valueOf(expression).code, location)
|
||||||
is IrConstKind.Float -> body.buildConstF32(kind.valueOf(expression))
|
is IrConstKind.Float -> body.buildConstF32(kind.valueOf(expression))
|
||||||
is IrConstKind.Double -> body.buildConstF64(kind.valueOf(expression))
|
is IrConstKind.Double -> body.buildConstF64(kind.valueOf(expression))
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ abstract class WasmExpressionBuilder {
|
|||||||
buildInstr(WasmOp.I32_CONST, location, WasmImmediate.ConstI32(value))
|
buildInstr(WasmOp.I32_CONST, location, WasmImmediate.ConstI32(value))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun buildConstI64(value: Long) {
|
fun buildConstI64(value: Long, location: SourceLocation) {
|
||||||
buildInstr(WasmOp.I64_CONST, WasmImmediate.ConstI64(value))
|
buildInstr(WasmOp.I64_CONST, location, WasmImmediate.ConstI64(value))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun buildConstF32(value: Float) {
|
fun buildConstF32(value: Float) {
|
||||||
|
|||||||
Reference in New Issue
Block a user