aboutsummaryrefslogtreecommitdiff
path: root/src/check_stmt.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2018-03-23 15:23:14 +0000
committergingerBill <bill@gingerbill.org>2018-03-23 15:23:14 +0000
commit5bf0f9d630f16287f7977bbec1d85af9bcb432cf (patch)
treea895fb66bc86417e3f70578cbe45218ac265464a /src/check_stmt.cpp
parentfff4ead96ab7cab8091f990e6a947a08a23fd3a4 (diff)
Fix type cycle bug
Diffstat (limited to 'src/check_stmt.cpp')
-rw-r--r--src/check_stmt.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp
index affdad8a5..be37b937c 100644
--- a/src/check_stmt.cpp
+++ b/src/check_stmt.cpp
@@ -1000,7 +1000,7 @@ void check_type_switch_stmt(Checker *c, AstNode *node, u32 mod_flags) {
check_open_scope(c, stmt);
{
- Entity *tag_var = make_entity_variable(c->allocator, c->context.scope, lhs->Ident.token, case_type, false);
+ Entity *tag_var = make_entity_variable(c->allocator, c->context.scope, lhs->Ident.token, case_type, false, EntityState_Resolved);
tag_var->flags |= EntityFlag_Used;
tag_var->flags |= EntityFlag_Value;
add_entity(c, c->context.scope, lhs, tag_var);
@@ -1467,7 +1467,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
}
if (found == nullptr) {
bool is_immutable = true;
- entity = make_entity_variable(c->allocator, c->context.scope, token, type, is_immutable);
+ entity = make_entity_variable(c->allocator, c->context.scope, token, type, is_immutable, EntityState_Resolved);
add_entity_definition(&c->info, name, entity);
} else {
TokenPos pos = found->token.pos;
@@ -1858,8 +1858,10 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
}
e->flags |= EntityFlag_Visited;
+ e->state = EntityState_InProgress;
if (e->type == nullptr) {
e->type = init_type;
+ e->state = EntityState_Resolved;
}
ac.link_name = handle_link_name(c, e->token, ac.link_name, ac.link_prefix);
e->Variable.thread_local_model = ac.thread_local_model;