Work on functions
This commit is contained in:
+7
-7
@@ -2,7 +2,6 @@
|
||||
|
||||
#include "function.h"
|
||||
#include "hashtable.h"
|
||||
#include "list.h"
|
||||
#include "memory.h"
|
||||
|
||||
#include <assert.h>
|
||||
@@ -46,6 +45,7 @@ void push_stack_frame(LispVal *name, LispVal *fobj, LispVal *args) {
|
||||
struct StackFrame *frame = &the_stack.frames[the_stack.depth++];
|
||||
frame->name = name;
|
||||
frame->fobj = fobj;
|
||||
frame->evaled_args = false;
|
||||
frame->args = args;
|
||||
frame->lexenv = Qnil;
|
||||
frame->local_refs.num_refs = 0;
|
||||
@@ -182,6 +182,12 @@ void add_local_reference(LispVal *obj) {
|
||||
release_hash_table_no_gc(seen_objs);
|
||||
}
|
||||
|
||||
void set_stack_evaluated_args(LispVal *args) {
|
||||
assert(the_stack.depth > 0);
|
||||
LISP_STACK_TOP()->evaled_args = true;
|
||||
LISP_STACK_TOP()->args = args;
|
||||
}
|
||||
|
||||
void compact_stack_frame(struct StackFrame *restrict frame) {
|
||||
struct LocalReferences *restrict refs = &frame->local_refs;
|
||||
for (size_t i = 1; i < refs->num_blocks; ++i) {
|
||||
@@ -206,12 +212,6 @@ bool set_lexical_variable(LispVal *name, LispVal *value,
|
||||
return create_if_absent;
|
||||
}
|
||||
|
||||
void new_lexical_variable(LispVal *name, LispVal *value) {
|
||||
assert(the_stack.depth != 0);
|
||||
LISP_STACK_TOP()->lexenv =
|
||||
CONS(name, CONS(value, LISP_STACK_TOP()->lexenv));
|
||||
}
|
||||
|
||||
void copy_parent_lexenv(void) {
|
||||
assert(the_stack.depth != 0);
|
||||
if (the_stack.depth > 1) {
|
||||
|
||||
Reference in New Issue
Block a user