inline senv_new

This commit is contained in:
Yuichi Nishiwaki 2014-04-05 01:21:16 +09:00
parent 0d0d4e6482
commit 9d2ac6b994
1 changed files with 6 additions and 10 deletions

View File

@ -48,24 +48,18 @@ pic_find_rename(pic_state *pic, struct pic_senv *senv, pic_sym sym, pic_sym *ren
static pic_value macroexpand(pic_state *, pic_value, struct pic_senv *, pic_value); static pic_value macroexpand(pic_state *, pic_value, struct pic_senv *, pic_value);
static pic_value macroexpand_list(pic_state *, pic_value, struct pic_senv *, pic_value); static pic_value macroexpand_list(pic_state *, pic_value, struct pic_senv *, pic_value);
static struct pic_senv * struct pic_senv *
senv_new(pic_state *pic, struct pic_senv *up) pic_null_syntactic_env(pic_state *pic)
{ {
struct pic_senv *senv; struct pic_senv *senv;
senv = (struct pic_senv *)pic_obj_alloc(pic, sizeof(struct pic_senv), PIC_TT_SENV); senv = (struct pic_senv *)pic_obj_alloc(pic, sizeof(struct pic_senv), PIC_TT_SENV);
senv->up = up; senv->up = NULL;
xh_init_int(&senv->renames, sizeof(pic_sym)); xh_init_int(&senv->renames, sizeof(pic_sym));
return senv; return senv;
} }
struct pic_senv *
pic_null_syntactic_env(pic_state *pic)
{
return senv_new(pic, NULL);
}
struct pic_senv * struct pic_senv *
pic_minimal_syntactic_env(pic_state *pic) pic_minimal_syntactic_env(pic_state *pic)
{ {
@ -100,7 +94,9 @@ push_scope(pic_state *pic, pic_value formals, struct pic_senv *up, pic_value ass
struct pic_senv *senv; struct pic_senv *senv;
pic_value a; pic_value a;
senv = senv_new(pic, up); senv = (struct pic_senv *)pic_obj_alloc(pic, sizeof(struct pic_senv), PIC_TT_SENV);
senv->up = up;
xh_init_int(&senv->renames, sizeof(pic_sym));
for (a = formals; pic_pair_p(a); a = pic_cdr(pic, a)) { for (a = formals; pic_pair_p(a); a = pic_cdr(pic, a)) {
pic_value v = pic_car(pic, a); pic_value v = pic_car(pic, a);