mirror of
https://github.com/samsonjs/lake.git
synced 2026-03-25 08:55:49 +00:00
move warnings & error messages out of core libs
This commit is contained in:
parent
a4423e42dd
commit
62bebe7bc6
3 changed files with 3 additions and 10 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue