From 1851674b5035527d16e342e9627fcf8e2da9e49e Mon Sep 17 00:00:00 2001 From: Ginger Bill Date: Thu, 15 Jun 2017 18:11:58 +0100 Subject: Code use API rather than raw CheckerInfo; begin work on generic procedures --- src/check_stmt.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/check_stmt.cpp') 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; -- cgit v1.2.3