From d4718f1106b5d82ddd70733c1ba7d440177c1f39 Mon Sep 17 00:00:00 2001 From: Camden Dixie O'Brien Date: Sat, 14 Mar 2026 13:52:10 +0000 Subject: [PATCH] Allow using defs in code --- asm.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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) {