mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-17 11:22:22 -07:00
Code use API rather than raw CheckerInfo; begin work on generic procedures
This commit is contained in:
+4
-7
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user