warn global redefinition
This commit is contained in:
parent
331fdaba4c
commit
7bb27295c0
|
@ -84,6 +84,7 @@ struct pic_proc *pic_codegen(pic_state *, pic_value);
|
|||
void pic_abort(pic_state *, const char *);
|
||||
void pic_raise(pic_state *, pic_value);
|
||||
void pic_error(pic_state *, const char *);
|
||||
void pic_warn(pic_state *, const char *);
|
||||
|
||||
void pic_debug(pic_state *, pic_value);
|
||||
|
||||
|
|
|
@ -139,6 +139,7 @@ scope_global_define(pic_state *pic, const char *name)
|
|||
struct xh_entry *e;
|
||||
|
||||
if ((e = xh_get(pic->global_tbl, name))) {
|
||||
pic_warn(pic, "redefining global");
|
||||
return e->val;
|
||||
}
|
||||
e = xh_put(pic->global_tbl, name, pic->glen++);
|
||||
|
|
|
@ -20,3 +20,9 @@ pic_abort(pic_state *pic, const char *msg)
|
|||
puts(msg);
|
||||
abort();
|
||||
}
|
||||
|
||||
void
|
||||
pic_warn(pic_state *pic, const char *msg)
|
||||
{
|
||||
fprintf(stderr, "warn: %s\n", msg);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue