mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-05 18:24:06 +00:00
Don't strip builtin attribute form AST
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user