Implement type, table and func symbol resolution

This commit is contained in:
2026-03-15 12:26:45 +00:00
parent 1452ffe615
commit 2155d17731

17
asm.js
View File

@@ -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];
}