diff options
| author | Ginger Bill <bill@gingerbill.org> | 2017-09-21 23:18:28 +0100 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2017-09-21 23:18:28 +0100 |
| commit | c43d66c286c0cf622402bd1e21f2bbc7de2a6b49 (patch) | |
| tree | 71a723ef4583645ff20415c376272065f06e882b /src/check_stmt.cpp | |
| parent | 95fb5fa46cfb3c90d6d69027f090364333d8f821 (diff) | |
Use comma for struct field separators (disallow nesting)
Diffstat (limited to 'src/check_stmt.cpp')
| -rw-r--r-- | src/check_stmt.cpp | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index d6c8f654d..9235d6055 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -472,24 +472,7 @@ bool check_using_stmt_entity(Checker *c, AstNodeUsingStmt *us, AstNode *expr, bo switch (e->kind) { case Entity_TypeName: { Type *t = base_type(e->type); - if (t->kind == Type_Struct) { - Scope *s = t->Struct.scope; - if (s != nullptr) { - for_array(i, s->elements.entries) { - Entity *f = s->elements.entries[i].value; - if (f->kind != Entity_Variable) { - Entity *found = scope_insert_entity(c->context.scope, f); - if (found != nullptr) { - gbString expr_str = expr_to_string(expr); - error(us->token, "Namespace collision while `using` `%s` of: %.*s", expr_str, LIT(found->token.string)); - gb_string_free(expr_str); - return false; - } - f->using_parent = e; - } - } - } - } else if (t->kind == Type_Enum) { + if (t->kind == Type_Enum) { for (isize i = 0; i < t->Enum.field_count; i++) { Entity *f = t->Enum.fields[i]; Entity *found = scope_insert_entity(c->context.scope, f); @@ -502,7 +485,7 @@ bool check_using_stmt_entity(Checker *c, AstNodeUsingStmt *us, AstNode *expr, bo f->using_parent = e; } } else { - error(us->token, "`using` can be only applied to struct type entities"); + error(us->token, "`using` can be only applied to enum type entities"); } } break; |