From 3cb61d07beb3d9589f668da4e998ab3efc1af777 Mon Sep 17 00:00:00 2001 From: Tucker Evans Date: Tue, 15 Oct 2019 19:20:11 -0400 Subject: Add array access on non-array error message --- sem_check.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sem_check.c b/sem_check.c index 4c8a0d3..64db636 100644 --- a/sem_check.c +++ b/sem_check.c @@ -127,9 +127,13 @@ ptree *t; break; } - type = t->l->attr.nval -> var_type; + type = t->l->attr.nval->var_type; if (type == ARRAY - INT || type == ARRAY - REAL) return ARRAY - type; + + snprintf(buf, 100, "%s is not an array (has type: %s)\n", + t->l->attr.nval->name, + pretty_type(type)); break; case IF: case WHILE: -- cgit v1.1