Skip to content

Commit 3f5df95

Browse files
committed
fixed: using #Self in unions or structs
1 parent cae0b40 commit 3f5df95

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

compiler/src/parser.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2652,6 +2652,9 @@ static AstStructType* parse_struct(OnyxParser* parser) {
26522652
s_node = make_node(AstStructType, Ast_Kind_Struct_Type);
26532653
s_node->token = s_token;
26542654

2655+
AstTyped *old_injection_point = parser->injection_point;
2656+
parser->injection_point = (AstTyped*) s_node;
2657+
26552658
flush_stored_tags(parser, &s_node->meta_tags);
26562659

26572660
type_create_scope(parser, &s_node->scope, s_node->token);
@@ -2829,6 +2832,7 @@ static AstStructType* parse_struct(OnyxParser* parser) {
28292832
}
28302833

28312834
parser->current_scope = scope_to_restore_parser_to;
2835+
parser->injection_point = old_injection_point;
28322836

28332837
bh_arr_free(member_list_temp);
28342838

@@ -2851,6 +2855,9 @@ static AstUnionType* parse_union(OnyxParser* parser) {
28512855
u_node = make_node(AstUnionType, Ast_Kind_Union_Type);
28522856
u_node->token = union_token;
28532857

2858+
AstTyped *old_injection_point = parser->injection_point;
2859+
parser->injection_point = (AstTyped*) u_node;
2860+
28542861
flush_stored_tags(parser, &u_node->meta_tags);
28552862

28562863
type_create_scope(parser, &u_node->scope, u_node->token);
@@ -2947,6 +2954,7 @@ static AstUnionType* parse_union(OnyxParser* parser) {
29472954
}
29482955

29492956
parser->current_scope = scope_to_restore_parser_to;
2957+
parser->injection_point = old_injection_point;
29502958

29512959
if (poly_union != NULL) {
29522960
// NOTE: Not a UnionType

0 commit comments

Comments
 (0)