The unified diff between revisions [f288316d..] and [8583f573..] is displayed below. It can also be downloaded as a raw diff.
# # old_revision [f288316da9714d1e11a3979cf3854e3cd99b5cb4] # new_revision [8583f573519b60d2a4dfb35aa4ec8079f05b88c1] # # patch "src/lsc/codegen.c" # from [400424bebce5876e321c5ffa9a3271c0993d48e9] # to [f72bb89ce47000e8908b8539ab2df2c84fefb118] # ============================================================ --- src/lsc/codegen.c 400424bebce5876e321c5ffa9a3271c0993d48e9 +++ src/lsc/codegen.c f72bb89ce47000e8908b8539ab2df2c84fefb118 @@ -549,6 +549,7 @@ void codegen(ast *node) int hasdefault; int i; int savedlineno; + int ncallargs; union { int i; @@ -616,9 +617,11 @@ void codegen(ast *node) * Arguments on the stack directly above * local variables, and then return address */ + printf("(argument)\n"); emit_instr_imm_const(OP_LOAD, sp + 1 + nargs - var.addr, fnconst); } else { + printf("(non-argument)\n"); emit_instr_imm_const(OP_LOAD, sp - var.addr - 1, fnconst); } sp++; @@ -777,14 +780,14 @@ void codegen(ast *node) // printf("savedsp = %d\n", savedsp); - nargs = 0; + ncallargs = 0; /* Evaluate the arguments first */ for (ptr = node->info.node.head->next->elem->info.node.head; ptr; ptr = ptr->next) { codegen(ptr->elem); - nargs++; + ncallargs++; } // printf("sp = %d\n", sp); @@ -800,7 +803,7 @@ void codegen(ast *node) * This is something only supported for * builtin functions at present. */ - emit_instr_immediate(OP_PUSH, nargs); + emit_instr_immediate(OP_PUSH, ncallargs); sp++; }