warn variable redefinition in macroexpansion level

This commit is contained in:
Yuichi Nishiwaki 2014-02-07 02:13:16 +09:00
parent d74b82b1a5
commit fd0553ac25
1 changed files with 3 additions and 0 deletions

View File

@ -497,6 +497,9 @@ macroexpand(pic_state *pic, pic_value expr, struct pic_senv *senv)
pic_error(pic, "binding to non-symbol object");
}
uniq = pic_gensym(pic, pic_sym(var));
if (xh_get_int(senv->tbl, pic_sym(var)) != NULL) {
pic_warn(pic, "redefining variable");
}
xh_put_int(senv->tbl, pic_sym(var), (int)uniq);
}
FALLTHROUGH;