diff options
| author | gingerBill <ginger.bill.22@gmail.com> | 2016-08-05 00:54:05 +0100 |
|---|---|---|
| committer | gingerBill <ginger.bill.22@gmail.com> | 2016-08-05 00:54:05 +0100 |
| commit | 2aaef48c5c362bb3e04d0c9cd1e722e21b3755e5 (patch) | |
| tree | f7b99cda983ce6226384127672abea74459b05b3 /src/checker/stmt.cpp | |
| parent | 19aea1f19895b035e8abb424987f48df6bc52c53 (diff) | |
String support
Diffstat (limited to 'src/checker/stmt.cpp')
| -rw-r--r-- | src/checker/stmt.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/checker/stmt.cpp b/src/checker/stmt.cpp index 676e74fa9..67ade56a5 100644 --- a/src/checker/stmt.cpp +++ b/src/checker/stmt.cpp @@ -408,11 +408,15 @@ void check_proc_decl(Checker *c, Entity *e, DeclInfo *d, b32 check_body_later) { e->type = proc_type; ast_node(pd, ProcDecl, d->proc_decl); -#if 1 Scope *original_curr_scope = c->context.scope; c->context.scope = c->global_scope; check_open_scope(c, pd->type); -#endif + defer ({ + check_close_scope(c); + c->context.scope = original_curr_scope; + }); + + check_procedure_type(c, proc_type, pd->type); b32 is_foreign = false; b32 is_inline = false; @@ -455,11 +459,6 @@ void check_proc_decl(Checker *c, Entity *e, DeclInfo *d, b32 check_body_later) { } } -#if 1 - check_close_scope(c); - c->context.scope = original_curr_scope; -#endif - } void check_var_decl(Checker *c, Entity *e, Entity **entities, isize entity_count, AstNode *type_expr, AstNode *init_expr) { @@ -554,8 +553,7 @@ void check_stmt(Checker *c, AstNode *node, u32 flags) { case_end; case_ast_node(ids, IncDecStmt, node); - Token op = {}; - op = ids->op; + Token op = ids->op; switch (ids->op.kind) { case Token_Increment: op.kind = Token_Add; @@ -717,9 +715,9 @@ void check_stmt(Checker *c, AstNode *node, u32 flags) { result_count = proc_type->procedure.results->tuple.variable_count; if (result_count != rs->result_count) { error(&c->error_collector, rs->token, "Expected %td return %s, got %td", - result_count, - (result_count != 1 ? "values" : "value"), - rs->result_count); + result_count, + (result_count != 1 ? "values" : "value"), + rs->result_count); } else if (result_count > 0) { auto *tuple = &proc_type->procedure.results->tuple; check_init_variables(c, tuple->variables, tuple->variable_count, |