diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-05-22 13:45:13 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-05-22 13:45:13 -0400 |
| commit | 7a741e65e663d9ce9013691d2479c6fdba4b798b (patch) | |
| tree | 7b0658afbdeef5b88b92aa9efedd0851bb9e16ca | |
| parent | 8c3d1e4066d8968ed709b791d902b69c302b7874 (diff) | |
Deprecate enum field access
| -rw-r--r-- | compile.c | 10 | ||||
| -rw-r--r-- | types.c | 8 |
2 files changed, 0 insertions, 18 deletions
@@ -1864,16 +1864,6 @@ CORD compile(env_t *env, ast_t *ast) } code_err(ast, "The field '%s' is not a valid field name of %T", f->field, value_t); } - case EnumType: { - auto enum_ = Match(value_t, EnumType); - for (tag_t *tag = enum_->tags; tag; tag = tag->next) { - if (streq(tag->name, f->field)) { - CORD fielded = compile_to_pointer_depth(env, f->fielded, 0, false); - return CORD_asprintf("$tagged(%r, %r%s, %s)", fielded, env->file_prefix, enum_->name, f->field); - } - } - code_err(ast, "The field '%s' is not a valid field name of %T", f->field, value_t); - } case TableType: { if (streq(f->field, "keys")) { return CORD_all("({ table_t *t = ", compile_to_pointer_depth(env, f->fielded, 1, false), ";\n" @@ -497,14 +497,6 @@ type_t *get_field_type(type_t *t, const char *field_name) } return NULL; } - case EnumType: { - auto e = Match(t, EnumType); - for (tag_t *tag = e->tags; tag; tag = tag->next) { - if (streq(field_name, tag->name)) - return Type(PointerType, .pointed=tag->type, .is_optional=true, .is_readonly=true); - } - return NULL; - } case TableType: { if (streq(field_name, "keys")) return Type(ArrayType, Match(t, TableType)->key_type); |
