|
|
|
@@ -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; |
|
|
|
try_void assert_type(form, Lisp_Object_Type::Pair); |
|
|
|
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"); |
|
|
|
|