aboutsummaryrefslogtreecommitdiff
path: root/src/checker/stmt.cpp
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2016-09-27 18:12:46 +0100
committerGinger Bill <bill@gingerbill.org>2016-09-27 18:12:46 +0100
commitf6bbd8a4c2206189c8c77f51b38a421d43d66e76 (patch)
tree60320177d2f94e701c3cdf6ab0170deb4bb55726 /src/checker/stmt.cpp
parent006741908b6bc42a621549cf869c2227cdf82f7b (diff)
Fix minimal dependency for nested entities
Diffstat (limited to 'src/checker/stmt.cpp')
-rw-r--r--src/checker/stmt.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/checker/stmt.cpp b/src/checker/stmt.cpp
index da3910f77..bd3a512fa 100644
--- a/src/checker/stmt.cpp
+++ b/src/checker/stmt.cpp
@@ -33,13 +33,14 @@ void check_stmt_list(Checker *c, AstNodeArray stmts, u32 flags) {
Entity *e = make_entity_constant(c->allocator, c->context.scope, name->Ident, NULL, v);
e->identifier = name;
- add_entity(c, e->scope, name, e);
- DeclInfo *di = make_declaration_info(c->allocator, e->scope);
- di->type_expr = cd->type;
- di->init_expr = value;
+ DeclInfo *d = make_declaration_info(c->allocator, e->scope);
+ d->type_expr = cd->type;
+ d->init_expr = value;
- Delay delay = {e, di};
+ add_entity_and_decl_info(c, name, e, d);
+
+ Delay delay = {e, d};
gb_array_append(delayed_const, delay);
}
@@ -61,6 +62,8 @@ void check_stmt_list(Checker *c, AstNodeArray stmts, u32 flags) {
DeclInfo *d = make_declaration_info(c->allocator, e->scope);
d->type_expr = td->type;
+ add_entity_and_decl_info(c, td->name, e, d);
+
Delay delay = {e, d};
gb_array_append(delayed_type, delay);
case_end;
@@ -1531,11 +1534,11 @@ void check_stmt(Checker *c, AstNode *node, u32 flags) {
// e.g. using
Entity *e = make_entity_procedure(c->allocator, c->context.scope, pd->name->Ident, NULL);
e->identifier = pd->name;
- add_entity(c, c->context.scope, pd->name, e);
DeclInfo *d = make_declaration_info(c->allocator, e->scope);
d->proc_decl = node;
+ add_entity_and_decl_info(c, pd->name, e, d);
check_entity_decl(c, e, d, NULL);
case_end;