diff options
author | Teddy <[email protected]> | 2014-04-05 11:53:13 +0800 |
---|---|---|
committer | Teddy <[email protected]> | 2014-04-05 11:53:13 +0800 |
commit | 92a572b05fbc81916a888bccd7a5c3a94567e2dd (patch) | |
tree | 52db972baa5d9e383a8a6decd77c7da628db995c | |
parent | e7822ec397e1bd645b7c668abf0a81f2d5cb4795 (diff) |
.
-rw-r--r-- | semantics.c | 5 |
1 files 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; } |