From 92a572b05fbc81916a888bccd7a5c3a94567e2dd Mon Sep 17 00:00:00 2001 From: Teddy Date: Sat, 5 Apr 2014 11:53:13 +0800 Subject: . --- semantics.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/semantics.c b/semantics.c index 2871e9c..f404fb5 100644 --- a/semantics.c +++ b/semantics.c @@ -1179,6 +1179,7 @@ ExpType semantics_exp(CNode *p, CScope_t scope) { } } break; + case NOP: ; break; default: assert(0); } p->ext.type = res.type; @@ -1214,7 +1215,7 @@ CVar_t semantics_for(CNode *p, CScope_t scope) { semantics_exp(p->chd, scope); semantics_exp(p->chd->next->next, scope); CVar_t res; - if (!IS_SCALAR(exp.type->type)) + if (p->chd->next->type != NOP && !IS_SCALAR(exp.type->type)) { sprintf(err_buff, "a scalar is required in 'for' condition"); ERROR(p->chd->next); @@ -1247,7 +1248,7 @@ CVar_t semantics_check_loop(CNode *p, CScope_t scope, const char *stmt_name) { if (!scope->inside_loop) { sprintf(err_buff, "%s statement not within a loop", stmt_name); - ERROR(p->chd); + ERROR(p); } return NULL; } -- cgit v1.2.3