Allow using defs in code
This commit is contained in:
11
asm.js
11
asm.js
@@ -675,14 +675,15 @@ export class Assembler {
|
|||||||
|
|
||||||
action_symbol(action) {
|
action_symbol(action) {
|
||||||
const func = this.funcs[this.current_func];
|
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_local(func, action.symbol)
|
||||||
?? this.lookup_global(action.symbol);
|
?? this.lookup_global(action.symbol)
|
||||||
if (index == null) {
|
?? this.lookup_def(action.symbol);
|
||||||
|
if (value == null) {
|
||||||
console.error(`ERROR: Unable to resolve symbol {action.symbol}`);
|
console.error(`ERROR: Unable to resolve symbol {action.symbol}`);
|
||||||
index = 0;
|
value = 0;
|
||||||
}
|
}
|
||||||
func.body.push(index);
|
func.body.push(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
action_mem(action) {
|
action_mem(action) {
|
||||||
|
|||||||
Reference in New Issue
Block a user