warn global redefinition
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user