This commit is contained in:
Yuichi Nishiwaki 2016-02-07 04:54:55 +09:00
parent 0d29322b64
commit ed14348c08
2 changed files with 5 additions and 5 deletions

View File

@ -9,7 +9,7 @@
(define (number->symbol n) (define (number->symbol n)
(string->symbol (number->string n))) (string->symbol (number->string n)))
(define (environment specs) (define (environment . specs)
(let ((library-name `(picrin @@my-environment ,(number->symbol counter)))) (let ((library-name `(picrin @@my-environment ,(number->symbol counter))))
(inc! counter) (inc! counter)
(let ((lib (make-library library-name))) (let ((lib (make-library library-name)))

View File

@ -889,18 +889,18 @@ pic_compile(pic_state *pic, pic_value obj)
pic_value pic_value
pic_eval(pic_state *pic, pic_value program, struct pic_lib *lib) pic_eval(pic_state *pic, pic_value program, struct pic_lib *lib)
{ {
struct pic_lib *prev_lib = pic->lib;
pic_value r; pic_value r;
pic->lib = lib;
pic_try { pic_try {
pic->prev_lib = pic->lib;
pic->lib = lib;
r = pic_apply0(pic, pic_compile(pic, pic_expand(pic, program, lib->env))); r = pic_apply0(pic, pic_compile(pic, pic_expand(pic, program, lib->env)));
} }
pic_catch { pic_catch {
pic->lib = pic->prev_lib; pic->lib = prev_lib;
pic_raise(pic, pic->err); pic_raise(pic, pic->err);
} }
pic->lib = prev_lib;
return r; return r;
} }