aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src/ast
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-30 19:32:12 +0100
committerAleksey Kladov <[email protected]>2018-08-30 19:32:12 +0100
commit8f552ab35222b7ea571f7ea9357db41489ae2247 (patch)
treeaf26565a1269276bf3026349b191be98ae5f3ea5 /crates/libsyntax2/src/ast
parent80ab3433d3376b7c44787d63af6e7b3217ae41d8 (diff)
break/continue completion
Diffstat (limited to 'crates/libsyntax2/src/ast')
-rw-r--r--crates/libsyntax2/src/ast/generated.rs17
-rw-r--r--crates/libsyntax2/src/ast/mod.rs6
2 files changed, 10 insertions, 13 deletions
diff --git a/crates/libsyntax2/src/ast/generated.rs b/crates/libsyntax2/src/ast/generated.rs
index 1bb3b11d1..0668dbfa7 100644
--- a/crates/libsyntax2/src/ast/generated.rs
+++ b/crates/libsyntax2/src/ast/generated.rs
@@ -593,6 +593,7 @@ impl<'a> AstNode<'a> for ForExpr<'a> {
593 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } 593 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
594} 594}
595 595
596impl<'a> ast::LoopBodyOwner<'a> for ForExpr<'a> {}
596impl<'a> ForExpr<'a> { 597impl<'a> ForExpr<'a> {
597 pub fn pat(self) -> Option<Pat<'a>> { 598 pub fn pat(self) -> Option<Pat<'a>> {
598 super::child_opt(self) 599 super::child_opt(self)
@@ -601,10 +602,6 @@ impl<'a> ForExpr<'a> {
601 pub fn iterable(self) -> Option<Expr<'a>> { 602 pub fn iterable(self) -> Option<Expr<'a>> {
602 super::child_opt(self) 603 super::child_opt(self)
603 } 604 }
604
605 pub fn body(self) -> Option<Block<'a>> {
606 super::child_opt(self)
607 }
608} 605}
609 606
610// ForType 607// ForType
@@ -845,11 +842,8 @@ impl<'a> AstNode<'a> for LoopExpr<'a> {
845 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } 842 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
846} 843}
847 844
848impl<'a> LoopExpr<'a> { 845impl<'a> ast::LoopBodyOwner<'a> for LoopExpr<'a> {}
849 pub fn body(self) -> Option<Block<'a>> { 846impl<'a> LoopExpr<'a> {}
850 super::child_opt(self)
851 }
852}
853 847
854// MatchArm 848// MatchArm
855#[derive(Debug, Clone, Copy)] 849#[derive(Debug, Clone, Copy)]
@@ -2106,13 +2100,10 @@ impl<'a> AstNode<'a> for WhileExpr<'a> {
2106 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } 2100 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
2107} 2101}
2108 2102
2103impl<'a> ast::LoopBodyOwner<'a> for WhileExpr<'a> {}
2109impl<'a> WhileExpr<'a> { 2104impl<'a> WhileExpr<'a> {
2110 pub fn condition(self) -> Option<Condition<'a>> { 2105 pub fn condition(self) -> Option<Condition<'a>> {
2111 super::child_opt(self) 2106 super::child_opt(self)
2112 } 2107 }
2113
2114 pub fn body(self) -> Option<Block<'a>> {
2115 super::child_opt(self)
2116 }
2117} 2108}
2118 2109
diff --git a/crates/libsyntax2/src/ast/mod.rs b/crates/libsyntax2/src/ast/mod.rs
index 3b5e9269f..49e283f5e 100644
--- a/crates/libsyntax2/src/ast/mod.rs
+++ b/crates/libsyntax2/src/ast/mod.rs
@@ -20,6 +20,12 @@ pub trait NameOwner<'a>: AstNode<'a> {
20 } 20 }
21} 21}
22 22
23pub trait LoopBodyOwner<'a>: AstNode<'a> {
24 fn loop_body(self) -> Option<Block<'a>> {
25 child_opt(self)
26 }
27}
28
23pub trait TypeParamsOwner<'a>: AstNode<'a> { 29pub trait TypeParamsOwner<'a>: AstNode<'a> {
24 fn type_param_list(self) -> Option<TypeParamList<'a>> { 30 fn type_param_list(self) -> Option<TypeParamList<'a>> {
25 child_opt(self) 31 child_opt(self)