diff options
author | Tucker Evans <tuckerevans24@gmail.com> | 2019-10-15 19:20:11 -0400 |
---|---|---|
committer | Tucker Evans <tuckerevans24@gmail.com> | 2019-10-15 19:20:11 -0400 |
commit | 3cb61d07beb3d9589f668da4e998ab3efc1af777 (patch) | |
tree | a8f6314deaffb56447b88a84fdf8bb6e59eb0db5 | |
parent | 85f3229e2811b75047c563d23ae3f51db17d4dd3 (diff) |
Add array access on non-array error message
-rw-r--r-- | sem_check.c | 6 |
1 files changed, 5 insertions, 1 deletions
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: |