Introduce dedicated AST node for union

Although structs and unions have the same syntax and differ only in
the keyword, re-using the single syntax node for both of them leads to
confusion in practice, and propagates further down the hir in an
upleasent way.

Moreover, static and consts also share syntax, but we use different
nodes for them.
This commit is contained in:
Aleksey Kladov 2019-11-25 16:55:09 +03:00
parent be00d74c7b
commit e1c0bdaf75
7 changed files with 63 additions and 15 deletions

View file

@ -1,5 +1,5 @@
SOURCE_FILE@[0; 51)
STRUCT_DEF@[0; 12)
UNION_DEF@[0; 12)
UNION_KW@[0; 5) "union"
WHITESPACE@[5; 6) " "
NAME@[6; 9)
@ -9,7 +9,7 @@ SOURCE_FILE@[0; 51)
L_CURLY@[10; 11) "{"
R_CURLY@[11; 12) "}"
WHITESPACE@[12; 13) "\n"
STRUCT_DEF@[13; 50)
UNION_DEF@[13; 50)
UNION_KW@[13; 18) "union"
WHITESPACE@[18; 19) " "
NAME@[19; 22)

View file

@ -1592,7 +1592,7 @@ SOURCE_FILE@[0; 3813)
BLOCK@[2845; 2906)
L_CURLY@[2845; 2846) "{"
WHITESPACE@[2846; 2851) "\n "
STRUCT_DEF@[2851; 2904)
UNION_DEF@[2851; 2904)
UNION_KW@[2851; 2856) "union"
WHITESPACE@[2856; 2857) " "
NAME@[2857; 2862)