aboutsummaryrefslogtreecommitdiff
path: root/src/check_stmt.cpp
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-07-10 22:42:58 +0100
committerGinger Bill <bill@gingerbill.org>2017-07-10 22:42:58 +0100
commitd936ca1ea003f82e0fda330cbad1f5bcf4387df2 (patch)
tree8df386ad4d9a360b1efd4a0193bf4b516f4b5781 /src/check_stmt.cpp
parentfd8c4d58bb476f858b5238287b6e9911dd5c333c (diff)
Compiler internal change: TypeRecord_Enum -> Type_Enum
Diffstat (limited to 'src/check_stmt.cpp')
-rw-r--r--src/check_stmt.cpp40
1 files changed, 5 insertions, 35 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp
index 3f7b9a456..2abc6c756 100644
--- a/src/check_stmt.cpp
+++ b/src/check_stmt.cpp
@@ -489,39 +489,10 @@ bool check_using_stmt_entity(Checker *c, AstNodeUsingStmt *us, AstNode *expr, bo
f->using_parent = e;
}
}
- } else if (is_type_enum(t)) {
- for (isize i = 0; i < t->Record.field_count; i++) {
- Entity *f = t->Record.fields[i];
- 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 {
- error(us->token, "`using` can be only applied to record type entities");
- }
- /* if (is_type_union(t)) {
- TokenPos pos = ast_node_token(expr).pos;
- for (isize i = 1; i < t->Record.variant_count; i++) {
- Entity *f = t->Record.variants[i];
- // gb_printf_err("%s\n", type_to_string(f->type));
- 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 (is_type_enum(t)) {
- for (isize i = 0; i < t->Record.field_count; i++) {
- Entity *f = t->Record.fields[i];
+ } else 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);
if (found != nullptr) {
gbString expr_str = expr_to_string(expr);
@@ -531,10 +502,9 @@ 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 `union` or `enum` type entities");
- } */
+ error(us->token, "`using` can be only applied to record type entities");
+ }
} break;
case Entity_ImportName: {