diff --git a/asm.js b/asm.js index 39dc49d..cfb0912 100644 --- a/asm.js +++ b/asm.js @@ -750,12 +750,17 @@ export class Assembler { ?? this.lookup_param(func, action.symbol) ?? this.lookup_local(func, action.symbol) ?? this.lookup_global(action.symbol) - ?? this.lookup_def(action.symbol); if (value == null) { - console.error( - `ERROR: Unable to resolve symbol ${action.symbol}`); + const def_value = this.lookup_def(action.symbol); + if (def_value == null) { + console.error( + `ERROR: Unable to resolve symbol ${action.symbol}`); + return; + } + func.body.push(...this.leb128(def_value)); + } else { + func.body.push(value); } - func.body.push(value); } action_mem(action) {