diff --git a/asm.js b/asm.js index cb1de69..6d69eb2 100644 --- a/asm.js +++ b/asm.js @@ -675,14 +675,15 @@ export class Assembler { action_symbol(action) { const func = this.funcs[this.current_func]; - const index = this.lookup_param(func, action.symbol) + const value = this.lookup_param(func, action.symbol) ?? this.lookup_local(func, action.symbol) - ?? this.lookup_global(action.symbol); - if (index == null) { + ?? this.lookup_global(action.symbol) + ?? this.lookup_def(action.symbol); + if (value == null) { console.error(`ERROR: Unable to resolve symbol {action.symbol}`); - index = 0; + value = 0; } - func.body.push(index); + func.body.push(value); } action_mem(action) {