make-library returns existing library if name conflicts

This commit is contained in:
Yuichi Nishiwaki 2013-12-07 23:15:16 -08:00
parent fabe70aaf2
commit 906f2c8a93
1 changed files with 4 additions and 0 deletions

View File

@ -9,6 +9,10 @@ pic_make_library(pic_state *pic, pic_value name)
{ {
struct pic_lib *lib; struct pic_lib *lib;
if ((lib = pic_find_library(pic, name)) != NULL) {
return lib;
}
lib = (struct pic_lib *)pic_obj_alloc(pic, sizeof(struct pic_lib), PIC_TT_LIB); lib = (struct pic_lib *)pic_obj_alloc(pic, sizeof(struct pic_lib), PIC_TT_LIB);
lib->senv = pic_minimal_syntactic_env(pic); lib->senv = pic_minimal_syntactic_env(pic);
lib->exports = xh_new(); lib->exports = xh_new();