From 2155d177313da2ba46ec6a54dec132555aa2d3a3 Mon Sep 17 00:00:00 2001 From: Camden Dixie O'Brien Date: Sun, 15 Mar 2026 12:26:45 +0000 Subject: [PATCH] Implement type, table and func symbol resolution --- asm.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/asm.js b/asm.js index 5f4a556..705f04a 100644 --- a/asm.js +++ b/asm.js @@ -947,6 +947,9 @@ export class Assembler { ?? this.lookup_param(func, action.symbol) ?? this.lookup_local(func, action.symbol) ?? this.lookup_global(action.symbol) + ?? this.lookup_table(action.symbol) + ?? this.lookup_type(action.symbol) + ?? this.lookup_func(action.symbol) if (value == null) { const def_value = this.lookup_def(action.symbol); if (def_value == null) { @@ -1092,6 +1095,20 @@ export class Assembler { return index == -1 ? null : index; } + lookup_table(symbol) { + const index = Object.keys(this.tables).indexOf(symbol); + return index == -1 ? null : index; + } + + lookup_type(symbol) { + return this.type_bindings[symbol]; + } + + lookup_func(symbol) { + const index = Object.keys(this.funcs).indexOf(symbol); + return index == -1 ? null : index; + } + lookup_def(symbol) { return this.defs[symbol]; }