diff options
Diffstat (limited to 'crates/libsyntax2/src/grammar/items/mod.rs')
-rw-r--r-- | crates/libsyntax2/src/grammar/items/mod.rs | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/crates/libsyntax2/src/grammar/items/mod.rs b/crates/libsyntax2/src/grammar/items/mod.rs index 8c19aa179..2567313ab 100644 --- a/crates/libsyntax2/src/grammar/items/mod.rs +++ b/crates/libsyntax2/src/grammar/items/mod.rs | |||
@@ -181,7 +181,16 @@ fn items_without_modifiers(p: &mut Parser) -> Option<SyntaxKind> { | |||
181 | MODULE | 181 | MODULE |
182 | } | 182 | } |
183 | STRUCT_KW => { | 183 | STRUCT_KW => { |
184 | nominal::struct_def(p); | 184 | // test struct_items |
185 | // struct Foo; | ||
186 | // struct Foo {} | ||
187 | // struct Foo(); | ||
188 | // struct Foo(String, usize); | ||
189 | // struct Foo { | ||
190 | // a: i32, | ||
191 | // b: f32, | ||
192 | // } | ||
193 | nominal::struct_def(p, STRUCT_KW); | ||
185 | if p.at(SEMI) { | 194 | if p.at(SEMI) { |
186 | p.err_and_bump( | 195 | p.err_and_bump( |
187 | "expected item, found `;`\n\ | 196 | "expected item, found `;`\n\ |
@@ -190,6 +199,16 @@ fn items_without_modifiers(p: &mut Parser) -> Option<SyntaxKind> { | |||
190 | } | 199 | } |
191 | STRUCT_DEF | 200 | STRUCT_DEF |
192 | } | 201 | } |
202 | IDENT if p.at_contextual_kw("union") => { | ||
203 | // test union_items | ||
204 | // union Foo {} | ||
205 | // union Foo { | ||
206 | // a: i32, | ||
207 | // b: f32, | ||
208 | // } | ||
209 | nominal::struct_def(p, UNION_KW); | ||
210 | STRUCT_DEF | ||
211 | } | ||
193 | ENUM_KW => { | 212 | ENUM_KW => { |
194 | nominal::enum_def(p); | 213 | nominal::enum_def(p); |
195 | ENUM_DEF | 214 | ENUM_DEF |