aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorVille Penttinen <[email protected]>2019-03-31 08:56:48 +0100
committerVille Penttinen <[email protected]>2019-03-31 08:56:48 +0100
commit55dcdb7d094f473c73f87ecf997b24f8e35f2a5e (patch)
tree996d113c7be91d4f0f96abc7764fd2d5f14ca921 /crates
parent245c0d85840b3ef6e969e1a6786bdfb5285b0cea (diff)
Add trait ast::TypeBoundsOwner
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_syntax/src/ast.rs6
-rw-r--r--crates/ra_syntax/src/ast/generated.rs5
-rw-r--r--crates/ra_syntax/src/grammar.ron15
3 files changed, 21 insertions, 5 deletions
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs
index a6fac07c4..4fddc00ea 100644
--- a/crates/ra_syntax/src/ast.rs
+++ b/crates/ra_syntax/src/ast.rs
@@ -110,6 +110,12 @@ pub trait TypeParamsOwner: AstNode {
110 } 110 }
111} 111}
112 112
113pub trait TypeBoundsOwner: AstNode {
114 fn type_bound_list(&self) -> Option<&TypeBoundList> {
115 child_opt(self)
116 }
117}
118
113pub trait AttrsOwner: AstNode { 119pub trait AttrsOwner: AstNode {
114 fn attrs(&self) -> AstChildren<Attr> { 120 fn attrs(&self) -> AstChildren<Attr> {
115 children(self) 121 children(self)
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index faf80bc32..9ea423b40 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -685,6 +685,7 @@ impl ToOwned for DynTraitType {
685} 685}
686 686
687 687
688impl ast::TypeBoundsOwner for DynTraitType {}
688impl DynTraitType {} 689impl DynTraitType {}
689 690
690// EnumDef 691// EnumDef
@@ -1581,6 +1582,7 @@ impl ToOwned for ImplTraitType {
1581} 1582}
1582 1583
1583 1584
1585impl ast::TypeBoundsOwner for ImplTraitType {}
1584impl ImplTraitType {} 1586impl ImplTraitType {}
1585 1587
1586// IndexExpr 1588// IndexExpr
@@ -4061,6 +4063,7 @@ impl ast::NameOwner for TraitDef {}
4061impl ast::AttrsOwner for TraitDef {} 4063impl ast::AttrsOwner for TraitDef {}
4062impl ast::DocCommentsOwner for TraitDef {} 4064impl ast::DocCommentsOwner for TraitDef {}
4063impl ast::TypeParamsOwner for TraitDef {} 4065impl ast::TypeParamsOwner for TraitDef {}
4066impl ast::TypeBoundsOwner for TraitDef {}
4064impl TraitDef { 4067impl TraitDef {
4065 pub fn item_list(&self) -> Option<&ItemList> { 4068 pub fn item_list(&self) -> Option<&ItemList> {
4066 super::child_opt(self) 4069 super::child_opt(self)
@@ -4291,6 +4294,7 @@ impl ast::NameOwner for TypeAliasDef {}
4291impl ast::TypeParamsOwner for TypeAliasDef {} 4294impl ast::TypeParamsOwner for TypeAliasDef {}
4292impl ast::AttrsOwner for TypeAliasDef {} 4295impl ast::AttrsOwner for TypeAliasDef {}
4293impl ast::DocCommentsOwner for TypeAliasDef {} 4296impl ast::DocCommentsOwner for TypeAliasDef {}
4297impl ast::TypeBoundsOwner for TypeAliasDef {}
4294impl TypeAliasDef { 4298impl TypeAliasDef {
4295 pub fn type_ref(&self) -> Option<&TypeRef> { 4299 pub fn type_ref(&self) -> Option<&TypeRef> {
4296 super::child_opt(self) 4300 super::child_opt(self)
@@ -4465,6 +4469,7 @@ impl ToOwned for TypeParam {
4465 4469
4466impl ast::NameOwner for TypeParam {} 4470impl ast::NameOwner for TypeParam {}
4467impl ast::AttrsOwner for TypeParam {} 4471impl ast::AttrsOwner for TypeParam {}
4472impl ast::TypeBoundsOwner for TypeParam {}
4468impl TypeParam {} 4473impl TypeParam {}
4469 4474
4470// TypeParamList 4475// TypeParamList
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron
index 660a2b207..18730a894 100644
--- a/crates/ra_syntax/src/grammar.ron
+++ b/crates/ra_syntax/src/grammar.ron
@@ -295,7 +295,7 @@ Grammar(
295 "EnumVariantList": ( collections: [["variants", "EnumVariant"]] ), 295 "EnumVariantList": ( collections: [["variants", "EnumVariant"]] ),
296 "EnumVariant": ( traits: ["NameOwner", "DocCommentsOwner", "AttrsOwner"], options: ["Expr"] ), 296 "EnumVariant": ( traits: ["NameOwner", "DocCommentsOwner", "AttrsOwner"], options: ["Expr"] ),
297 "TraitDef": ( 297 "TraitDef": (
298 traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner", "TypeParamsOwner"], 298 traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner", "TypeParamsOwner", "TypeBoundsOwner"],
299 options: ["ItemList"] 299 options: ["ItemList"]
300 ), 300 ),
301 "Module": ( 301 "Module": (
@@ -332,7 +332,8 @@ Grammar(
332 "NameOwner", 332 "NameOwner",
333 "TypeParamsOwner", 333 "TypeParamsOwner",
334 "AttrsOwner", 334 "AttrsOwner",
335 "DocCommentsOwner" 335 "DocCommentsOwner",
336 "TypeBoundsOwner",
336 ], 337 ],
337 options: ["TypeRef"] 338 options: ["TypeRef"]
338 ), 339 ),
@@ -349,8 +350,12 @@ Grammar(
349 "PlaceholderType": (), 350 "PlaceholderType": (),
350 "FnPointerType": (options: ["ParamList", "RetType"]), 351 "FnPointerType": (options: ["ParamList", "RetType"]),
351 "ForType": (options: ["TypeRef"]), 352 "ForType": (options: ["TypeRef"]),
352 "ImplTraitType": (), 353 "ImplTraitType": (
353 "DynTraitType": (), 354 traits: ["TypeBoundsOwner"],
355 ),
356 "DynTraitType": (
357 traits: ["TypeBoundsOwner"],
358 ),
354 359
355 "TypeRef": ( enum: [ 360 "TypeRef": ( enum: [
356 "ParenType", 361 "ParenType",
@@ -573,7 +578,7 @@ Grammar(
573 ["lifetime_params", "LifetimeParam" ], 578 ["lifetime_params", "LifetimeParam" ],
574 ] 579 ]
575 ), 580 ),
576 "TypeParam": ( traits: ["NameOwner", "AttrsOwner"] ), 581 "TypeParam": ( traits: ["NameOwner", "AttrsOwner", "TypeBoundsOwner"] ),
577 "LifetimeParam": ( 582 "LifetimeParam": (
578 options: [ "Lifetime"], 583 options: [ "Lifetime"],
579 traits: ["AttrsOwner"], 584 traits: ["AttrsOwner"],