summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-04-23 16:05:45 -0400
committerLeo Tenenbaum <pommicket@gmail.com>2020-04-23 16:05:45 -0400
commiteb8eca81e997c3fbf454a636b2097629e8e8d0ea (patch)
tree756299a9459d407148efca35bdc5df2778a23c59 /eval.c
parent9db4ea5189f6f1a8b264c9948090c822f5e008b1 (diff)
fixed problem with undeclared identifiers
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/eval.c b/eval.c
index f8ef498..88e6f13 100644
--- a/eval.c
+++ b/eval.c
@@ -663,8 +663,8 @@ static Status eval_expr_ptr_at_index(Evaluator *ev, Expression *e, void **ptr, T
}
static Value *ident_val(Evaluator *ev, Identifier i, Location where) {
- assert(ident_is_declared(i));
Declaration *decl = i->decl;
+ assert(decl);
int idx = decl_ident_index(decl, i);
if (decl->type.kind == TYPE_UNKNOWN && ev->typer->err_ctx->have_errored)
return NULL; /* silently fail (something went wrong when we typed this decl) */
@@ -1016,7 +1016,7 @@ static bool val_is_nonnegative(Value v, Type *t) {
}
static Status eval_ident(Evaluator *ev, Identifier ident, Value *v, Location where) {
- if (!ident_is_declared(ident)) {
+ if (!ident) {
char *s = ident_to_str(ident);
err_print(where, "Undeclared identifier: %s.", s);
free(s);