aboutsummaryrefslogtreecommitdiff
path: root/src/check_stmt.cpp
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-06-15 18:11:58 +0100
committerGinger Bill <bill@gingerbill.org>2017-06-15 18:11:58 +0100
commit1851674b5035527d16e342e9627fcf8e2da9e49e (patch)
tree04cde40837141448f2eb8dc60ea46480c93d6b72 /src/check_stmt.cpp
parentc5ef5279d4346fe1b38815060303b17159adbc82 (diff)
Code use API rather than raw CheckerInfo; begin work on generic procedures
Diffstat (limited to 'src/check_stmt.cpp')
-rw-r--r--src/check_stmt.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp
index 8b1590e59..fbf301878 100644
--- a/src/check_stmt.cpp
+++ b/src/check_stmt.cpp
@@ -530,9 +530,7 @@ bool check_using_stmt_entity(Checker *c, AstNodeUsingStmt *us, AstNode *expr, bo
Type *t = base_type(type_deref(e->type));
if (is_type_struct(t) || is_type_raw_union(t) || is_type_union(t)) {
// TODO(bill): Make it work for unions too
- Scope **found_ = map_get(&c->info.scopes, hash_pointer(t->Record.node));
- GB_ASSERT(found_ != NULL);
- Scope *found = *found_;
+ Scope *found = scope_of_node(&c->info, t->Record.node);
for_array(i, found->elements.entries) {
Entity *f = found->elements.entries[i].value;
if (f->kind == Entity_Variable) {
@@ -1695,10 +1693,9 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
Type *t = base_type(type_deref(e->type));
if (is_type_struct(t) || is_type_raw_union(t)) {
- Scope **found = map_get(&c->info.scopes, hash_pointer(t->Record.node));
- GB_ASSERT(found != NULL);
- for_array(i, (*found)->elements.entries) {
- Entity *f = (*found)->elements.entries[i].value;
+ Scope *scope = scope_of_node(&c->info, t->Record.node);
+ for_array(i, scope->elements.entries) {
+ Entity *f = scope->elements.entries[i].value;
if (f->kind == Entity_Variable) {
Entity *uvar = make_entity_using_variable(c->allocator, e, f->token, f->type);
uvar->Variable.is_immutable = is_immutable;