aboutsummaryrefslogtreecommitdiff
path: root/src/checker.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-05-30 20:26:22 +0100
committergingerBill <bill@gingerbill.org>2023-05-30 20:26:22 +0100
commit9d299143044f88c2c91dbc8c46cea17cf8de98df (patch)
treeaa37f69e0779db533946e3b73cea6f1472473289 /src/checker.cpp
parent837ba6c33b3d78dce332eeb5d5abe7da5d4f8b3a (diff)
Don't strip `builtin` attribute form AST
Diffstat (limited to 'src/checker.cpp')
-rw-r--r--src/checker.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/checker.cpp b/src/checker.cpp
index c22ad1645..fd5f8e1e8 100644
--- a/src/checker.cpp
+++ b/src/checker.cpp
@@ -3469,6 +3469,8 @@ gb_internal void check_decl_attributes(CheckerContext *c, Array<Ast *> const &at
StringSet set = {};
defer (string_set_destroy(&set));
+ bool is_runtime = ((c->scope->parent->flags&(ScopeFlag_File|ScopeFlag_Pkg)) != 0 && c->scope->file->pkg->kind == Package_Runtime);
+
for_array(i, attributes) {
Ast *attr = attributes[i];
if (attr->kind != Ast_Attribute) continue;
@@ -3504,6 +3506,10 @@ gb_internal void check_decl_attributes(CheckerContext *c, Array<Ast *> const &at
continue;
}
+ if (name == "builtin" && is_runtime) {
+ continue;
+ }
+
if (!proc(c, elem, name, value, ac)) {
if (!build_context.ignore_unknown_attributes) {
error(elem, "Unknown attribute element name '%.*s'", LIT(name));
@@ -3663,9 +3669,9 @@ gb_internal void check_builtin_attributes(CheckerContext *ctx, Entity *e, Array<
error(value, "'builtin' cannot have a field value");
}
// Remove the builtin tag
- attr->Attribute.elems[k] = attr->Attribute.elems[attr->Attribute.elems.count-1];
- attr->Attribute.elems.count -= 1;
- k--;
+ // attr->Attribute.elems[k] = attr->Attribute.elems[attr->Attribute.elems.count-1];
+ // attr->Attribute.elems.count -= 1;
+ // k--;
mutex_unlock(&ctx->info->builtin_mutex);
}