mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-31 15:47:31 +00:00
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:
parent
be00d74c7b
commit
e1c0bdaf75
7 changed files with 63 additions and 15 deletions
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue