mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-16 02:42:22 -07:00
Allow $ in polymorphic record parameter fields (but disallow mixing)
This commit is contained in:
+12
-4
@@ -152,10 +152,12 @@ void check_struct_fields(CheckerContext *ctx, Ast *node, Array<Entity *> *fields
|
||||
|
||||
for_array(j, p->names) {
|
||||
Ast *name = p->names[j];
|
||||
if (!ast_node_expect(name, Ast_Ident)) {
|
||||
if (!ast_node_expect2(name, Ast_Ident, Ast_PolyType)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (name->kind == Ast_PolyType) {
|
||||
name = name->PolyType.type;
|
||||
}
|
||||
Token name_token = name->Ident.token;
|
||||
|
||||
Entity *field = alloc_entity_field(ctx->scope, name_token, type, is_using, field_src_index);
|
||||
@@ -464,9 +466,12 @@ void check_struct_type(CheckerContext *ctx, Type *struct_type, Ast *node, Array<
|
||||
Scope *scope = ctx->scope;
|
||||
for_array(j, p->names) {
|
||||
Ast *name = p->names[j];
|
||||
if (!ast_node_expect(name, Ast_Ident)) {
|
||||
if (!ast_node_expect2(name, Ast_Ident, Ast_PolyType)) {
|
||||
continue;
|
||||
}
|
||||
if (name->kind == Ast_PolyType) {
|
||||
name = name->PolyType.type;
|
||||
}
|
||||
Entity *e = nullptr;
|
||||
|
||||
Token token = name->Ident.token;
|
||||
@@ -680,9 +685,12 @@ void check_union_type(CheckerContext *ctx, Type *union_type, Ast *node, Array<Op
|
||||
Scope *scope = ctx->scope;
|
||||
for_array(j, p->names) {
|
||||
Ast *name = p->names[j];
|
||||
if (!ast_node_expect(name, Ast_Ident)) {
|
||||
if (!ast_node_expect2(name, Ast_Ident, Ast_PolyType)) {
|
||||
continue;
|
||||
}
|
||||
if (name->kind == Ast_PolyType) {
|
||||
name = name->PolyType.type;
|
||||
}
|
||||
Entity *e = nullptr;
|
||||
|
||||
Token token = name->Ident.token;
|
||||
|
||||
Reference in New Issue
Block a user