aboutsummaryrefslogtreecommitdiff
path: root/src/check_decl.cpp
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-07-30 22:26:22 +0100
committerGinger Bill <bill@gingerbill.org>2017-07-30 22:26:22 +0100
commit8987a6630c8ec43da770dd92c10f6b92e17201f2 (patch)
tree9233cacae498d1321edc94470c1549012091dcf0 /src/check_decl.cpp
parent10ff8e042606d44049f4cb91c372d0da2a83ed65 (diff)
v0.6.0v0.6.0
Diffstat (limited to 'src/check_decl.cpp')
-rw-r--r--src/check_decl.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/check_decl.cpp b/src/check_decl.cpp
index 8b2ab0941..5d0fc5ed3 100644
--- a/src/check_decl.cpp
+++ b/src/check_decl.cpp
@@ -711,8 +711,11 @@ void check_proc_body(Checker *c, Token token, DeclInfo *decl, Type *type, AstNod
bool is_immutable = e->Variable.is_immutable;
String name = e->token.string;
Type *t = base_type(type_deref(e->type));
- if (is_type_struct(t) || is_type_raw_union(t)) {
- Scope *scope = scope_of_node(&c->info, t->Struct.node);
+ if (t->kind == Type_Struct) {
+ Scope *scope = t->Struct.scope;
+ if (scope == nullptr) {
+ scope = scope_of_node(&c->info, t->Struct.node);
+ }
GB_ASSERT(scope != nullptr);
for_array(i, scope->elements.entries) {
Entity *f = scope->elements.entries[i].value;
@@ -727,7 +730,7 @@ void check_proc_body(Checker *c, Token token, DeclInfo *decl, Type *type, AstNod
}
}
} else {
- error(e->token, "`using` can only be applied to variables of type struct or raw_union");
+ error(e->token, "`using` can only be applied to variables of type struct");
break;
}
}
@@ -749,7 +752,6 @@ void check_proc_body(Checker *c, Token token, DeclInfo *decl, Type *type, AstNod
}
pop_procedure(c);
-
check_scope_usage(c, c->context.scope);
if (decl->parent != nullptr) {