aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r--crates/ra_syntax/src/ast.rs7
-rw-r--r--crates/ra_syntax/src/ast/generated.rs1
-rw-r--r--crates/ra_syntax/src/grammar.ron4
3 files changed, 10 insertions, 2 deletions
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs
index b92cc082e..165b308d1 100644
--- a/crates/ra_syntax/src/ast.rs
+++ b/crates/ra_syntax/src/ast.rs
@@ -431,6 +431,13 @@ impl StructDef {
431} 431}
432 432
433impl EnumVariant { 433impl EnumVariant {
434 pub fn parent_enum(&self) -> &EnumDef {
435 self.syntax()
436 .parent()
437 .and_then(|it| it.parent())
438 .and_then(EnumDef::cast)
439 .expect("EnumVariants are always nested in Enums")
440 }
434 pub fn flavor(&self) -> StructFlavor { 441 pub fn flavor(&self) -> StructFlavor {
435 StructFlavor::from_node(self) 442 StructFlavor::from_node(self)
436 } 443 }
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index e39b58827..bb223e0dc 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -3649,6 +3649,7 @@ impl ast::VisibilityOwner for TraitDef {}
3649impl ast::NameOwner for TraitDef {} 3649impl ast::NameOwner for TraitDef {}
3650impl ast::AttrsOwner for TraitDef {} 3650impl ast::AttrsOwner for TraitDef {}
3651impl ast::DocCommentsOwner for TraitDef {} 3651impl ast::DocCommentsOwner for TraitDef {}
3652impl ast::TypeParamsOwner for TraitDef {}
3652impl TraitDef {} 3653impl TraitDef {}
3653 3654
3654// TrueKw 3655// TrueKw
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron
index c5297e46d..dedefea59 100644
--- a/crates/ra_syntax/src/grammar.ron
+++ b/crates/ra_syntax/src/grammar.ron
@@ -280,7 +280,7 @@ Grammar(
280 ], options: [["variant_list", "EnumVariantList"]] ), 280 ], options: [["variant_list", "EnumVariantList"]] ),
281 "EnumVariantList": ( collections: [["variants", "EnumVariant"]] ), 281 "EnumVariantList": ( collections: [["variants", "EnumVariant"]] ),
282 "EnumVariant": ( traits: ["NameOwner", "DocCommentsOwner"], options: ["Expr"] ), 282 "EnumVariant": ( traits: ["NameOwner", "DocCommentsOwner"], options: ["Expr"] ),
283 "TraitDef": ( traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner"] ), 283 "TraitDef": ( traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner", "TypeParamsOwner"] ),
284 "Module": ( 284 "Module": (
285 traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner" ], 285 traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner" ],
286 options: [ "ItemList" ] 286 options: [ "ItemList" ]
@@ -489,7 +489,7 @@ Grammar(
489 ), 489 ),
490 490
491 "RefPat": ( options: [ "Pat" ]), 491 "RefPat": ( options: [ "Pat" ]),
492 "BindPat": ( 492 "BindPat": (
493 options: [ "Pat" ], 493 options: [ "Pat" ],
494 traits: ["NameOwner"] 494 traits: ["NameOwner"]
495 ), 495 ),