diff --git a/nasal_runtime.h b/nasal_runtime.h index 396e227..86bc7b7 100644 --- a/nasal_runtime.h +++ b/nasal_runtime.h @@ -1292,7 +1292,13 @@ int nasal_runtime::calculation(nasal_ast& node,int local_scope_addr) // after this process, a new address(in nasal_vm.garbage_collector_memory) will be returned int ret_address=-1; int calculation_type=node.get_type(); - if(calculation_type==ast_nil) + if(calculation_type==ast_null) + { + ret_address=nasal_vm.gc_alloc(); + nasal_vm.gc_get(ret_address).set_type(vm_number); + nasal_vm.gc_get(ret_address).set_number(1); + } + else if(calculation_type==ast_nil) { ret_address=nasal_vm.gc_alloc(); nasal_vm.gc_get(ret_address).set_type(vm_nil); @@ -1311,7 +1317,8 @@ int nasal_runtime::calculation(nasal_ast& node,int local_scope_addr) { std::cout<<">> [runtime] calculation: cannot find value named \'"<> [runtime] calculation: expression type:"<> [runtime] calculation: incorrect values.\n"; - ++error; + ret_address=nasal_vm.gc_alloc(); + nasal_vm.gc_get(ret_address).set_type(vm_nil); } return ret_address; }