function bodys can now be empty.. sigh
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
;; (define (empty-function-body-test))
|
||||||
@@ -11,7 +11,7 @@ call cl ^
|
|||||||
../src/main.cpp^
|
../src/main.cpp^
|
||||||
/I../3rd/ ^
|
/I../3rd/ ^
|
||||||
/D_PROFILING /D_DEBUG ^
|
/D_PROFILING /D_DEBUG ^
|
||||||
/Zi /std:c++latest /Fe%exeName% /W3 /wd4003 /nologo /EHsc
|
/Zi /std:c++latest /Fe%exeName% /W3 /wd4003 /wd4996 /nologo /EHsc
|
||||||
|
|
||||||
rem call ..\timecmd cl ^
|
rem call ..\timecmd cl ^
|
||||||
rem ../src/main.cpp^
|
rem ../src/main.cpp^
|
||||||
@@ -21,14 +21,14 @@ rem call ..\timecmd cl ^
|
|||||||
|
|
||||||
rem call ..\timecmd clang-cl ../src/main.cpp -o %exeName% /O2 /std:c++latest /W3 /Zi /EHsc
|
rem call ..\timecmd clang-cl ../src/main.cpp -o %exeName% /O2 /std:c++latest /W3 /Zi /EHsc
|
||||||
|
|
||||||
rem if %errorlevel% == 0 (
|
if %errorlevel% == 0 (
|
||||||
rem echo.
|
echo.
|
||||||
rem echo ---- Running Tests ----
|
echo ---- Running Tests ----
|
||||||
rem echo.
|
echo.
|
||||||
rem call slime.exe --run-tests
|
call slime.exe --run-tests
|
||||||
rem ) else (
|
) else (
|
||||||
rem echo.
|
echo.
|
||||||
rem echo Fuckin' ell
|
echo Fuckin' ell
|
||||||
rem )
|
)
|
||||||
|
|
||||||
popd
|
popd
|
||||||
|
|||||||
+13
-5
@@ -295,7 +295,9 @@ namespace Slime {
|
|||||||
Lisp_Object* form = pcs.data[--pcs.next_index];
|
Lisp_Object* form = pcs.data[--pcs.next_index];
|
||||||
Lisp_Object* definee = form->value.pair.first;
|
Lisp_Object* definee = form->value.pair.first;
|
||||||
form = form->value.pair.rest;
|
form = form->value.pair.rest;
|
||||||
|
if (definee->type == Lisp_Object_Type::Symbol) {
|
||||||
try_void assert_type(form, Lisp_Object_Type::Pair);
|
try_void assert_type(form, Lisp_Object_Type::Pair);
|
||||||
|
}
|
||||||
Lisp_Object* thing = form->value.pair.first;
|
Lisp_Object* thing = form->value.pair.first;
|
||||||
Lisp_Object* thing_cons = form;
|
Lisp_Object* thing_cons = form;
|
||||||
form = form->value.pair.rest;
|
form = form->value.pair.rest;
|
||||||
@@ -322,10 +324,15 @@ namespace Slime {
|
|||||||
try_void func = Memory::create_lisp_object_function(Lisp_Function_Type::Lambda);
|
try_void func = Memory::create_lisp_object_function(Lisp_Function_Type::Lambda);
|
||||||
func->value.function->parent_environment = get_current_environment();
|
func->value.function->parent_environment = get_current_environment();
|
||||||
create_arguments_from_lambda_list_and_inject(definee->value.pair.rest, func);
|
create_arguments_from_lambda_list_and_inject(definee->value.pair.rest, func);
|
||||||
if (thing_cons->value.pair.first->type == Lisp_Object_Type::String &&
|
|
||||||
thing_cons->value.pair.rest != Memory::nil)
|
if (thing_cons->type == Lisp_Object_Type::Pair &&
|
||||||
{
|
// if there is stuff in the function body
|
||||||
// extract docs
|
thing_cons->value.pair.first->type == Lisp_Object_Type::String &&
|
||||||
|
// if the first is a string
|
||||||
|
thing_cons->value.pair.rest != Memory::nil
|
||||||
|
// if it is not the last
|
||||||
|
) {
|
||||||
|
// we found docs
|
||||||
Globals::docs.set_object(
|
Globals::docs.set_object(
|
||||||
func,
|
func,
|
||||||
Memory::duplicate_string(
|
Memory::duplicate_string(
|
||||||
@@ -333,8 +340,9 @@ namespace Slime {
|
|||||||
thing_cons = thing_cons->value.pair.rest;
|
thing_cons = thing_cons->value.pair.rest;
|
||||||
}
|
}
|
||||||
func->value.function->body.lisp_body = maybe_wrap_body_in_begin(thing_cons);
|
func->value.function->body.lisp_body = maybe_wrap_body_in_begin(thing_cons);
|
||||||
|
|
||||||
define_symbol(definee->value.pair.first, func);
|
define_symbol(definee->value.pair.first, func);
|
||||||
cs.append(Memory::t);
|
cs.append(definee->value.pair.first);
|
||||||
} break;
|
} break;
|
||||||
default: {
|
default: {
|
||||||
create_generic_error("you can only define symbols");
|
create_generic_error("you can only define symbols");
|
||||||
|
|||||||
@@ -303,6 +303,8 @@ namespace Slime {
|
|||||||
|
|
||||||
inline proc maybe_wrap_body_in_begin(Lisp_Object* body) -> Lisp_Object* {
|
inline proc maybe_wrap_body_in_begin(Lisp_Object* body) -> Lisp_Object* {
|
||||||
Lisp_Object* begin_symbol = Memory::get_symbol("begin");
|
Lisp_Object* begin_symbol = Memory::get_symbol("begin");
|
||||||
|
if (body->type != Lisp_Object_Type::Pair)
|
||||||
|
return body;
|
||||||
if (body->value.pair.rest == Memory::nil)
|
if (body->value.pair.rest == Memory::nil)
|
||||||
return body->value.pair.first;
|
return body->value.pair.first;
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -142,7 +142,6 @@ namespace Slime {
|
|||||||
} value;
|
} value;
|
||||||
};
|
};
|
||||||
#pragma options align=reset
|
#pragma options align=reset
|
||||||
|
|
||||||
struct Error {
|
struct Error {
|
||||||
Lisp_Object* position;
|
Lisp_Object* position;
|
||||||
// type has to be a keyword
|
// type has to be a keyword
|
||||||
|
|||||||
+2
-1
@@ -592,7 +592,7 @@ namespace Slime {
|
|||||||
|
|
||||||
bool result = true;
|
bool result = true;
|
||||||
try Memory::init();
|
try Memory::init();
|
||||||
|
try Memory::load_pre();
|
||||||
push_environment(Memory::create_child_environment(
|
push_environment(Memory::create_child_environment(
|
||||||
get_current_environment()));
|
get_current_environment()));
|
||||||
printf("-- Util --\n");
|
printf("-- Util --\n");
|
||||||
@@ -622,6 +622,7 @@ namespace Slime {
|
|||||||
pop_environment();
|
pop_environment();
|
||||||
printf("\n-- Test Files --\n");
|
printf("\n-- Test Files --\n");
|
||||||
|
|
||||||
|
invoke_test_script("regression");
|
||||||
invoke_test_script("evaluation_of_default_args");
|
invoke_test_script("evaluation_of_default_args");
|
||||||
invoke_test_script("case_and_cond");
|
invoke_test_script("case_and_cond");
|
||||||
invoke_test_script("lexical_scope");
|
invoke_test_script("lexical_scope");
|
||||||
|
|||||||
Reference in New Issue
Block a user