diff --git a/nasal_gc.h b/nasal_gc.h index cae2b12..0c9f9dd 100644 --- a/nasal_gc.h +++ b/nasal_gc.h @@ -106,13 +106,13 @@ struct nasal_hash// 56 bytes struct nasal_func// 112 bytes { - uint32_t dynpara; // dynamic parameter index in hash. index 0 is reserved for 'me'. + int32_t dynpara; // dynamic parameter name index in hash. uint32_t entry; // pc will set to entry-1 to call this function std::vector local; // local scope with default value(nasal_ref) std::vector upvalue; // closure std::unordered_map keys; // parameter name table - nasal_func():dynpara(0){} + nasal_func():dynpara(-1){} void clear(); }; @@ -265,7 +265,7 @@ void nasal_hash::print() /*functions of nasal_func*/ void nasal_func::clear() { - dynpara=0; + dynpara=-1; local.clear(); upvalue.clear(); keys.clear(); diff --git a/nasal_vm.h b/nasal_vm.h index 351b1fc..d96c1d4 100644 --- a/nasal_vm.h +++ b/nasal_vm.h @@ -665,7 +665,7 @@ inline void nasal_vm::opr_callfv() for(uint32_t i=0;i=para_size - if(func.dynpara) + if(func.dynpara>=0) { nasal_ref vec=gc.alloc(vm_vec); for(uint32_t i=para_size;ielems=func.local; // load parameters auto& closure=gc.local.back().vec()->elems; - if(func.dynpara) + if(func.dynpara>=0) die("callfh: special call cannot use dynamic argument"); for(auto& i:func.keys)