diff --git a/makefile b/makefile index 7e643c0..9633f76 100644 --- a/makefile +++ b/makefile @@ -52,7 +52,7 @@ test:nasal @ ./nasal -op -t -d test/mandel.nas @ ./nasal -op -t -d test/mandelbrot.nas @ ./nasal -op -t -d test/md5.nas - -@ ./nasal -op -t -d test/md5compare.nas + @ ./nasal -op -t -d test/md5compare.nas -@ ./nasal -op -d test/module_test.nas @ ./nasal -op -e test/nasal_test.nas @ ./nasal -op -c test/occupation.nas @@ -66,5 +66,4 @@ test:nasal -@ ./nasal -op -c -t test/tetris.nas @ ./nasal -op -c -t -d test/turingmachine.nas @ ./nasal -op -c -t -d test/ycombinator.nas - @ ./nasal -op -d test/wavecollapse.nas - \ No newline at end of file + @ ./nasal -op -d test/wavecollapse.nas \ No newline at end of file diff --git a/nasal_codegen.h b/nasal_codegen.h index 09c9480..4a2b063 100644 --- a/nasal_codegen.h +++ b/nasal_codegen.h @@ -447,9 +447,9 @@ void nasal_codegen::hash_gen(const nasal_ast& ast) void nasal_codegen::func_gen(const nasal_ast& ast) { - int newfunc_label=code.size(); + usize newf=code.size(); gen(op_newf,0,ast.line()); - int local_label=code.size(); + usize lsize=code.size(); gen(op_intl,0,ast.line()); // add special keyword 'me' into symbol table @@ -478,8 +478,8 @@ void nasal_codegen::func_gen(const nasal_ast& ast) add_sym(str); } - code[newfunc_label].num=code.size()+1; - int jmp_ptr=code.size(); + code[newf].num=code.size()+1; // entry + usize jmp_ptr=code.size(); gen(op_jmp,0,ast.line()); const nasal_ast& block=ast[1]; @@ -489,7 +489,7 @@ void nasal_codegen::func_gen(const nasal_ast& ast) in_iterloop.push(0); block_gen(block); in_iterloop.pop(); - code[local_label].num=local.back().size(); + code[lsize].num=local.back().size(); if(local.back().size()>=STACK_DEPTH) die("too many local variants: "+std::to_string(local.back().size())+".",block.line()); local.pop_back(); @@ -507,8 +507,7 @@ void nasal_codegen::call_gen(const nasal_ast& ast) calc_gen(ast[0]); if(code.back().op==op_callb) return; - int child_size=ast.size(); - for(int i=1;i