aboutsummaryrefslogtreecommitdiff
path: root/src/check_type.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2018-07-29 10:50:15 +0100
committergingerBill <bill@gingerbill.org>2018-07-29 10:50:15 +0100
commit6512a3e5f24a3aecb1451f921455a93231412104 (patch)
treee784404bf3ad291c54314e9ab9690e9bd9da754f /src/check_type.cpp
parent49f2124df0f644e183f0570dd047493678eaf9f1 (diff)
using Foo :: enum {A, B, C}; len(Foo)
Diffstat (limited to 'src/check_type.cpp')
-rw-r--r--src/check_type.cpp23
1 files changed, 4 insertions, 19 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp
index b73389865..4f44e0c4d 100644
--- a/src/check_type.cpp
+++ b/src/check_type.cpp
@@ -571,22 +571,10 @@ void check_enum_type(CheckerContext *ctx, Type *enum_type, Type *named_type, Ast
// NOTE(bill): Skip blank identifiers
if (is_blank_ident(name)) {
continue;
- } else if (name == "count") {
- error(field, "'count' is a reserved identifier for enumerations");
- continue;
- } else if (name == "min_value") {
- error(field, "'min_value' is a reserved identifier for enumerations");
- continue;
- } else if (name == "max_value") {
- error(field, "'max_value' is a reserved identifier for enumerations");
- continue;
} else if (name == "names") {
error(field, "'names' is a reserved identifier for enumerations");
continue;
- }/* else if (name == "base_type") {
- error(field, "'base_type' is a reserved identifier for enumerations");
- continue;
- } */
+ }
if (compare_exact_values(Token_Gt, min_value, iota)) {
min_value = iota;
@@ -613,8 +601,9 @@ void check_enum_type(CheckerContext *ctx, Type *enum_type, Type *named_type, Ast
enum_type->Enum.fields = fields;
- enum_type->Enum.is_export = et->is_export;
- if (et->is_export) {
+ enum_type->Enum.is_using = et->is_using;
+ // TODO(bill): Should this be done elsewhere? e.g. delayed
+ if (et->is_using) {
Scope *parent = ctx->scope->parent;
if (parent->flags&ScopeFlag_File) {
// NOTE(bill): Use package scope
@@ -634,10 +623,6 @@ void check_enum_type(CheckerContext *ctx, Type *enum_type, Type *named_type, Ast
}
Scope *s = ctx->scope;
- enum_type->Enum.count = alloc_entity_constant(s, make_token_ident(str_lit("count")), t_int, exact_value_i64(fields.count));
- enum_type->Enum.min_value = alloc_entity_constant(s, make_token_ident(str_lit("min_value")), constant_type, min_value);
- enum_type->Enum.max_value = alloc_entity_constant(s, make_token_ident(str_lit("max_value")), constant_type, max_value);
-
enum_type->Enum.names = make_names_field_for_struct(ctx, ctx->scope);
}