default args are eveled at current environment now

This commit is contained in:
FelixBrendel
2019-09-26 18:11:08 +02:00
parent 5f82694233
commit d42ada70ef
2 changed files with 9 additions and 3 deletions
Executable → Regular
View File
+9 -3
View File
@@ -173,9 +173,9 @@ proc load_built_ins_into_environment() -> void {
auto label(sym,__LINE__) = label(params,__LINE__)->value.pair.first; \ auto label(sym,__LINE__) = label(params,__LINE__)->value.pair.first; \
auto label(sfun,__LINE__) = Memory::create_lisp_object_cfunction(special); \ auto label(sfun,__LINE__) = Memory::create_lisp_object_cfunction(special); \
/*NOTE(Felix): for evaluating default args*/ \ /*NOTE(Felix): for evaluating default args*/ \
push_environment(get_root_environment()); \ /*push_environment(get_root_environment());*/ \
create_arguments_from_lambda_list_and_inject(label(params,__LINE__)->value.pair.rest, label(sfun,__LINE__)); \ create_arguments_from_lambda_list_and_inject(label(params,__LINE__)->value.pair.rest, label(sfun,__LINE__)); \
pop_environment(); \ /*pop_environment(); */ \
label(sfun,__LINE__)->sourceCodeLocation = new(Source_Code_Location); \ label(sfun,__LINE__)->sourceCodeLocation = new(Source_Code_Location); \
label(sfun,__LINE__)->sourceCodeLocation->file = file_name_built_ins; \ label(sfun,__LINE__)->sourceCodeLocation->file = file_name_built_ins; \
label(sfun,__LINE__)->sourceCodeLocation->line = __LINE__; \ label(sfun,__LINE__)->sourceCodeLocation->line = __LINE__; \
@@ -190,7 +190,13 @@ proc load_built_ins_into_environment() -> void {
Globals::Current_Execution::envi_stack.next_index, \ Globals::Current_Execution::envi_stack.next_index, \
Globals::Current_Execution::envi_stack.next_index-1) Globals::Current_Execution::envi_stack.next_index-1)
define((helper), "") {
return Memory::create_lisp_object_number(101);
};
define((test (:k (helper))), "") {
fetch(k);
return k;
};
define((= . args), define((= . args),
"Takes 0 or more arguments and returns =t= if all arguments are equal " "Takes 0 or more arguments and returns =t= if all arguments are equal "
"and =()= otherwise.") "and =()= otherwise.")