diff options
author | Søren Sandmann Pedersen <ssp@redhat.com> | 2010-11-16 15:46:27 -0500 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@redhat.com> | 2010-11-16 15:48:05 -0500 |
commit | a5e98bf07c2603cadde51d6e1020a65f4bb7662f (patch) | |
tree | b46c4ac5ca3044cd4cac459f15eb747027696eb5 /type-check.c | |
parent | d9c0a66a2ebf5f1b515407de199a5b7db20765ee (diff) |
Type check goto statements
Diffstat (limited to 'type-check.c')
-rw-r--r-- | type-check.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/type-check.c b/type-check.c index 1b5542b..f68e5a0 100644 --- a/type-check.c +++ b/type-check.c @@ -664,7 +664,9 @@ type_check_expression (ast_expression_t *expr) !expr->new.args[0] || !is_int32 (get_type (expr->new.args[0]))) { - return report_error ("Array constructions must have exactly one integer argument"); + return report_error ( + "Array constructions must have exactly one " + "integer argument"); } } else if (expr->new.args[0]) @@ -838,6 +840,14 @@ type_check_pass2 (ast_t *ast) "Condition in for statement must be boolean\n"); } } + else if (ast_is (ast, AST_STATEMENT, AST_GOTO_STATEMENT)) + { + if (!is_label (get_type (ast->statement.goto_.target))) + { + return report_error ( + "Target of goto must be a label\n"); + } + } else if (ast_is (ast, AST_STATEMENT, AST_IF_STATEMENT)) { if (!is_bool (get_type (ast->statement.if_.condition))) |