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^
|
||||
/I../3rd/ ^
|
||||
/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 ../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 if %errorlevel% == 0 (
|
||||
rem echo.
|
||||
rem echo ---- Running Tests ----
|
||||
rem echo.
|
||||
rem call slime.exe --run-tests
|
||||
rem ) else (
|
||||
rem echo.
|
||||
rem echo Fuckin' ell
|
||||
rem )
|
||||
if %errorlevel% == 0 (
|
||||
echo.
|
||||
echo ---- Running Tests ----
|
||||
echo.
|
||||
call slime.exe --run-tests
|
||||
) else (
|
||||
echo.
|
||||
echo Fuckin' ell
|
||||
)
|
||||
|
||||
popd
|
||||
|
||||
+14
-5
@@ -295,11 +295,14 @@ namespace Slime {
|
||||
Lisp_Object* form = pcs.data[--pcs.next_index];
|
||||
Lisp_Object* definee = form->value.pair.first;
|
||||
form = form->value.pair.rest;
|
||||
if (definee->type == Lisp_Object_Type::Symbol) {
|
||||
try_void assert_type(form, Lisp_Object_Type::Pair);
|
||||
}
|
||||
Lisp_Object* thing = form->value.pair.first;
|
||||
Lisp_Object* thing_cons = form;
|
||||
form = form->value.pair.rest;
|
||||
Lisp_Object_Type type = definee->type;
|
||||
debug_break();
|
||||
switch (type) {
|
||||
case Lisp_Object_Type::Symbol: {
|
||||
if (form != Memory::nil) {
|
||||
@@ -322,10 +325,15 @@ namespace Slime {
|
||||
try_void func = Memory::create_lisp_object_function(Lisp_Function_Type::Lambda);
|
||||
func->value.function->parent_environment = get_current_environment();
|
||||
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)
|
||||
{
|
||||
// extract docs
|
||||
|
||||
if (thing_cons->type == Lisp_Object_Type::Pair &&
|
||||
// if there is stuff in the function body
|
||||
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(
|
||||
func,
|
||||
Memory::duplicate_string(
|
||||
@@ -333,8 +341,9 @@ namespace Slime {
|
||||
thing_cons = thing_cons->value.pair.rest;
|
||||
}
|
||||
func->value.function->body.lisp_body = maybe_wrap_body_in_begin(thing_cons);
|
||||
|
||||
define_symbol(definee->value.pair.first, func);
|
||||
cs.append(Memory::t);
|
||||
cs.append(definee->value.pair.first);
|
||||
} break;
|
||||
default: {
|
||||
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* {
|
||||
Lisp_Object* begin_symbol = Memory::get_symbol("begin");
|
||||
if (body->type != Lisp_Object_Type::Pair)
|
||||
return body;
|
||||
if (body->value.pair.rest == Memory::nil)
|
||||
return body->value.pair.first;
|
||||
else
|
||||
|
||||
@@ -142,7 +142,6 @@ namespace Slime {
|
||||
} value;
|
||||
};
|
||||
#pragma options align=reset
|
||||
|
||||
struct Error {
|
||||
Lisp_Object* position;
|
||||
// type has to be a keyword
|
||||
|
||||
+2
-1
@@ -592,7 +592,7 @@ namespace Slime {
|
||||
|
||||
bool result = true;
|
||||
try Memory::init();
|
||||
|
||||
try Memory::load_pre();
|
||||
push_environment(Memory::create_child_environment(
|
||||
get_current_environment()));
|
||||
printf("-- Util --\n");
|
||||
@@ -622,6 +622,7 @@ namespace Slime {
|
||||
pop_environment();
|
||||
printf("\n-- Test Files --\n");
|
||||
|
||||
invoke_test_script("regression");
|
||||
invoke_test_script("evaluation_of_default_args");
|
||||
invoke_test_script("case_and_cond");
|
||||
invoke_test_script("lexical_scope");
|
||||
|
||||
Reference in New Issue
Block a user