diff options
| author | gingerBill <ginger.bill.22@gmail.com> | 2016-08-05 15:17:23 +0100 |
|---|---|---|
| committer | gingerBill <ginger.bill.22@gmail.com> | 2016-08-05 15:17:23 +0100 |
| commit | 4a303b5c3ef38bd99c36fa990c922917c0134d52 (patch) | |
| tree | fc46614cd8b13cbb84228911209fd505d46370b6 /src/checker/stmt.cpp | |
| parent | 2aaef48c5c362bb3e04d0c9cd1e722e21b3755e5 (diff) | |
Minor refactor and basic library
Diffstat (limited to 'src/checker/stmt.cpp')
| -rw-r--r-- | src/checker/stmt.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/checker/stmt.cpp b/src/checker/stmt.cpp index 67ade56a5..f3625def1 100644 --- a/src/checker/stmt.cpp +++ b/src/checker/stmt.cpp @@ -108,13 +108,13 @@ b32 check_is_assignable_to(Checker *c, Operand *operand, Type *type) { return true; if (sb->kind == Type_Array && tb->kind == Type_Array) { - if (are_types_identical(sb->array.element, tb->array.element)) { + if (are_types_identical(sb->array.elem, tb->array.elem)) { return sb->array.count == tb->array.count; } } if (sb->kind == Type_Slice && tb->kind == Type_Slice) { - if (are_types_identical(sb->slice.element, tb->slice.element)) { + if (are_types_identical(sb->slice.elem, tb->slice.elem)) { return true; } } @@ -391,7 +391,7 @@ void check_proc_body(Checker *c, Token token, DeclInfo *decl, Type *type, AstNod push_procedure(c, type); ast_node(bs, BlockStmt, body); check_stmt_list(c, bs->list, 0); - if (type->procedure.result_count > 0) { + if (type->proc.result_count > 0) { if (!check_is_terminating(c, body)) { error(&c->error_collector, bs->close, "Missing return statement at the end of the procedure"); } @@ -404,7 +404,7 @@ void check_proc_body(Checker *c, Token token, DeclInfo *decl, Type *type, AstNod void check_proc_decl(Checker *c, Entity *e, DeclInfo *d, b32 check_body_later) { GB_ASSERT(e->type == NULL); - Type *proc_type = make_type_procedure(c->allocator, e->parent, NULL, 0, NULL, 0); + Type *proc_type = make_type_proc(c->allocator, e->parent, NULL, 0, NULL, 0); e->type = proc_type; ast_node(pd, ProcDecl, d->proc_decl); @@ -701,7 +701,7 @@ void check_stmt(Checker *c, AstNode *node, u32 flags) { case_end; case_ast_node(rs, ReturnStmt, node); - GB_ASSERT(gb_array_count(c->procedure_stack) > 0); + GB_ASSERT(gb_array_count(c->proc_stack) > 0); if (c->in_defer) { error(&c->error_collector, rs->token, "You cannot `return` within a defer statement"); @@ -709,17 +709,17 @@ void check_stmt(Checker *c, AstNode *node, u32 flags) { break; } - Type *proc_type = c->procedure_stack[gb_array_count(c->procedure_stack)-1]; + Type *proc_type = c->proc_stack[gb_array_count(c->proc_stack)-1]; isize result_count = 0; - if (proc_type->procedure.results) - result_count = proc_type->procedure.results->tuple.variable_count; + if (proc_type->proc.results) + result_count = proc_type->proc.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); } else if (result_count > 0) { - auto *tuple = &proc_type->procedure.results->tuple; + auto *tuple = &proc_type->proc.results->tuple; check_init_variables(c, tuple->variables, tuple->variable_count, rs->result_list, rs->result_count, make_string("return statement")); } |