diff options
author | Ville Penttinen <[email protected]> | 2019-03-31 08:56:48 +0100 |
---|---|---|
committer | Ville Penttinen <[email protected]> | 2019-03-31 08:56:48 +0100 |
commit | 55dcdb7d094f473c73f87ecf997b24f8e35f2a5e (patch) | |
tree | 996d113c7be91d4f0f96abc7764fd2d5f14ca921 /crates | |
parent | 245c0d85840b3ef6e969e1a6786bdfb5285b0cea (diff) |
Add trait ast::TypeBoundsOwner
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_syntax/src/ast.rs | 6 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs | 5 | ||||
-rw-r--r-- | crates/ra_syntax/src/grammar.ron | 15 |
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 | ||
113 | pub trait TypeBoundsOwner: AstNode { | ||
114 | fn type_bound_list(&self) -> Option<&TypeBoundList> { | ||
115 | child_opt(self) | ||
116 | } | ||
117 | } | ||
118 | |||
113 | pub trait AttrsOwner: AstNode { | 119 | pub 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 | ||
688 | impl ast::TypeBoundsOwner for DynTraitType {} | ||
688 | impl DynTraitType {} | 689 | impl DynTraitType {} |
689 | 690 | ||
690 | // EnumDef | 691 | // EnumDef |
@@ -1581,6 +1582,7 @@ impl ToOwned for ImplTraitType { | |||
1581 | } | 1582 | } |
1582 | 1583 | ||
1583 | 1584 | ||
1585 | impl ast::TypeBoundsOwner for ImplTraitType {} | ||
1584 | impl ImplTraitType {} | 1586 | impl ImplTraitType {} |
1585 | 1587 | ||
1586 | // IndexExpr | 1588 | // IndexExpr |
@@ -4061,6 +4063,7 @@ impl ast::NameOwner for TraitDef {} | |||
4061 | impl ast::AttrsOwner for TraitDef {} | 4063 | impl ast::AttrsOwner for TraitDef {} |
4062 | impl ast::DocCommentsOwner for TraitDef {} | 4064 | impl ast::DocCommentsOwner for TraitDef {} |
4063 | impl ast::TypeParamsOwner for TraitDef {} | 4065 | impl ast::TypeParamsOwner for TraitDef {} |
4066 | impl ast::TypeBoundsOwner for TraitDef {} | ||
4064 | impl TraitDef { | 4067 | impl 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 {} | |||
4291 | impl ast::TypeParamsOwner for TypeAliasDef {} | 4294 | impl ast::TypeParamsOwner for TypeAliasDef {} |
4292 | impl ast::AttrsOwner for TypeAliasDef {} | 4295 | impl ast::AttrsOwner for TypeAliasDef {} |
4293 | impl ast::DocCommentsOwner for TypeAliasDef {} | 4296 | impl ast::DocCommentsOwner for TypeAliasDef {} |
4297 | impl ast::TypeBoundsOwner for TypeAliasDef {} | ||
4294 | impl TypeAliasDef { | 4298 | impl 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 | ||
4466 | impl ast::NameOwner for TypeParam {} | 4470 | impl ast::NameOwner for TypeParam {} |
4467 | impl ast::AttrsOwner for TypeParam {} | 4471 | impl ast::AttrsOwner for TypeParam {} |
4472 | impl ast::TypeBoundsOwner for TypeParam {} | ||
4468 | impl TypeParam {} | 4473 | impl 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"], |