disallow non-symbol objects at places where symbol is required
This commit is contained in:
parent
6fdd60b51c
commit
95a3f8880c
15
src/macro.c
15
src/macro.c
|
@ -216,17 +216,11 @@ macroexpand_lambda(pic_state *pic, pic_value expr, struct pic_senv *senv)
|
|||
for (a = pic_cadr(pic, expr); pic_pair_p(a); a = pic_cdr(pic, a)) {
|
||||
pic_value v = pic_car(pic, a);
|
||||
|
||||
if (! pic_sym_p(v)) {
|
||||
v = macroexpand(pic, v, senv);
|
||||
}
|
||||
if (! pic_sym_p(v)) {
|
||||
pic_error(pic, "syntax error");
|
||||
}
|
||||
pic_add_rename(pic, in, pic_sym(v));
|
||||
}
|
||||
if (! pic_sym_p(a)) {
|
||||
a = macroexpand(pic, a, senv);
|
||||
}
|
||||
if (pic_sym_p(a)) {
|
||||
pic_add_rename(pic, in, pic_sym(a));
|
||||
}
|
||||
|
@ -259,9 +253,6 @@ macroexpand_define(pic_state *pic, pic_value expr, struct pic_senv *senv)
|
|||
}
|
||||
var = formal;
|
||||
}
|
||||
if (! pic_sym_p(var)) {
|
||||
var = macroexpand(pic, var, senv);
|
||||
}
|
||||
if (! pic_sym_p(var)) {
|
||||
pic_error(pic, "binding to non-symbol object");
|
||||
}
|
||||
|
@ -289,9 +280,6 @@ macroexpand_defsyntax(pic_state *pic, pic_value expr, struct pic_senv *senv)
|
|||
}
|
||||
|
||||
var = pic_cadr(pic, expr);
|
||||
if (! pic_sym_p(var)) {
|
||||
var = macroexpand(pic, var, senv);
|
||||
}
|
||||
if (! pic_sym_p(var)) {
|
||||
pic_error(pic, "binding to non-symbol object");
|
||||
}
|
||||
|
@ -336,9 +324,6 @@ macroexpand_let_syntax(pic_state *pic, pic_value expr, struct pic_senv *senv)
|
|||
}
|
||||
pic_for_each (v, formal) {
|
||||
var = pic_car(pic, v);
|
||||
if (! pic_sym_p(var)) {
|
||||
var = macroexpand(pic, var, senv);
|
||||
}
|
||||
if (! pic_sym_p(var)) {
|
||||
pic_error(pic, "binding to non-symbol object");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue