diff --git a/asm.js b/asm.js index 4b89ace..cb1de69 100644 --- a/asm.js +++ b/asm.js @@ -752,8 +752,8 @@ export class Assembler { lookup_local(func, symbol) { const param_count = Object.entries(func.params).length; - const index = param_count + Object.keys(func.locals).indexOf(symbol); - return index == -1 ? null : index; + const index = Object.keys(func.locals).indexOf(symbol); + return index == -1 ? null : param_count + index; } lookup_global(symbol) {