import and export take multiple spec in a time
This commit is contained in:
parent
39b28fa674
commit
d871c6f06c
15
src/macro.c
15
src/macro.c
|
@ -279,7 +279,10 @@ macroexpand(pic_state *pic, pic_value expr, struct pic_senv *senv)
|
|||
struct pic_lib *lib;
|
||||
struct xh_iterator it;
|
||||
|
||||
lib = pic_find_library(pic, pic_cadr(pic, expr));
|
||||
for (v = pic_cdr(pic, expr); ! pic_nil_p(v); v = pic_cdr(pic, v)) {
|
||||
pic_value spec = pic_car(pic, v);
|
||||
|
||||
lib = pic_find_library(pic, spec);
|
||||
if (! lib) {
|
||||
pic_error(pic, "library not found");
|
||||
}
|
||||
|
@ -311,16 +314,18 @@ macroexpand(pic_state *pic, pic_value expr, struct pic_senv *senv)
|
|||
}
|
||||
xh_next(lib->exports, &it);
|
||||
}
|
||||
}
|
||||
return pic_false_value();
|
||||
}
|
||||
case PIC_STX_EXPORT: {
|
||||
v = pic_cadr(pic, expr);
|
||||
if (! pic_symbol_p(v)) {
|
||||
for (v = pic_cdr(pic, expr); ! pic_nil_p(v); v = pic_cdr(pic, v)) {
|
||||
pic_value spec = pic_car(pic, v);
|
||||
if (! pic_symbol_p(spec)) {
|
||||
pic_error(pic, "syntax error");
|
||||
}
|
||||
/* TODO: warn if symbol is shadowed by local variable */
|
||||
pic_export(pic, pic_sym(v));
|
||||
|
||||
pic_export(pic, pic_sym(spec));
|
||||
}
|
||||
return pic_false_value();
|
||||
}
|
||||
case PIC_STX_DEFSYNTAX: {
|
||||
|
|
Loading…
Reference in New Issue