[Wasm] Require location for buildSetGlobal and fix all usages

This commit is contained in:
Zalim Bashorov
2022-12-13 19:06:14 +01:00
parent 65e1b53027
commit 3967bd2755
2 changed files with 3 additions and 3 deletions
@@ -229,7 +229,7 @@ class BodyGenerator(
body.commentPreviousInstr { "name: ${field.name}, type: ${field.type.render()}" }
} else {
generateExpression(expression.value)
body.buildSetGlobal(context.referenceGlobalField(expression.symbol))
body.buildSetGlobal(context.referenceGlobalField(expression.symbol), expression.getSourceLocation())
body.commentPreviousInstr { "type: ${field.type.render()}" }
}
@@ -141,8 +141,8 @@ abstract class WasmExpressionBuilder {
buildInstr(WasmOp.GLOBAL_GET, location, WasmImmediate.GlobalIdx(global))
}
fun buildSetGlobal(global: WasmSymbol<WasmGlobal>) {
buildInstr(WasmOp.GLOBAL_SET, WasmImmediate.GlobalIdx(global))
fun buildSetGlobal(global: WasmSymbol<WasmGlobal>, location: SourceLocation) {
buildInstr(WasmOp.GLOBAL_SET, location, WasmImmediate.GlobalIdx(global))
}
fun buildStructGet(struct: WasmSymbol<WasmTypeDeclaration>, fieldId: WasmSymbol<Int>) {