move warnings & error messages out of core libs

This commit is contained in:
Sami Samhuri 2011-04-23 19:58:01 -07:00
parent a4423e42dd
commit 62bebe7bc6
3 changed files with 3 additions and 10 deletions

View file

@ -35,9 +35,6 @@ static void env_put(Env *env, LakeSym *key, LakeVal *val)
LakeVal *env_define(Env *env, LakeSym *key, LakeVal *val)
{
if (env_is_defined(env, key) == env) {
printf("warning: redefining %s\n", SYM_S(key));
}
env_put(env, key, val);
return val;
}
@ -58,9 +55,5 @@ LakeVal *env_get(Env *env, LakeSym *key)
if (!val && env->parent) {
val = env_get(env->parent, key);
}
if (!val) {
ERR("undefined variable: %s", SYM_S(key));
val = NULL;
}
return val;
}

View file

@ -253,6 +253,9 @@ LakeVal *eval(LakeCtx *ctx, Env *env, LakeVal *expr)
case TYPE_SYM:
result = env_get(env, (gpointer)SYM(expr));
if (!result) {
ERR("undefined variable: %s", SYM_S(SYM(expr)));
}
break;
case TYPE_DLIST:

View file

@ -97,9 +97,6 @@ LakeVal *list_set(LakeList *list, size_t i, LakeVal *val)
if (i >= 0 && i < list->n) {
list->vals[i] = val;
}
else {
ERR("list_set: index %zu is out of bounds (%zu)", i, list->n);
}
return NULL;
}