aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r--crates/ra_syntax/src/ast/edit.rs4
-rw-r--r--crates/ra_syntax/src/ast/generated/nodes.rs44
2 files changed, 35 insertions, 13 deletions
diff --git a/crates/ra_syntax/src/ast/edit.rs b/crates/ra_syntax/src/ast/edit.rs
index 3d428fab3..a01f6487d 100644
--- a/crates/ra_syntax/src/ast/edit.rs
+++ b/crates/ra_syntax/src/ast/edit.rs
@@ -32,9 +32,9 @@ impl ast::FnDef {
32 let mut to_insert: ArrayVec<[SyntaxElement; 2]> = ArrayVec::new(); 32 let mut to_insert: ArrayVec<[SyntaxElement; 2]> = ArrayVec::new();
33 let old_body_or_semi: SyntaxElement = if let Some(old_body) = self.body() { 33 let old_body_or_semi: SyntaxElement = if let Some(old_body) = self.body() {
34 old_body.syntax().clone().into() 34 old_body.syntax().clone().into()
35 } else if let Some(semi) = self.semi_token() { 35 } else if let Some(semi) = self.semicolon_token() {
36 to_insert.push(make::tokens::single_space().into()); 36 to_insert.push(make::tokens::single_space().into());
37 semi.syntax.clone().into() 37 semi.into()
38 } else { 38 } else {
39 to_insert.push(make::tokens::single_space().into()); 39 to_insert.push(make::tokens::single_space().into());
40 to_insert.push(body.syntax().clone().into()); 40 to_insert.push(body.syntax().clone().into());
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs
index 3b014e312..214e12918 100644
--- a/crates/ra_syntax/src/ast/generated/nodes.rs
+++ b/crates/ra_syntax/src/ast/generated/nodes.rs
@@ -58,7 +58,9 @@ impl FnDef {
58 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } 58 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
59 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } 59 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
60 pub fn body(&self) -> Option<BlockExpr> { support::child(&self.syntax) } 60 pub fn body(&self) -> Option<BlockExpr> { support::child(&self.syntax) }
61 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 61 pub fn semicolon_token(&self) -> Option<SyntaxToken> {
62 support::token2(&self.syntax, T ! [ ; ])
63 }
62} 64}
63#[derive(Debug, Clone, PartialEq, Eq, Hash)] 65#[derive(Debug, Clone, PartialEq, Eq, Hash)]
64pub struct RetType { 66pub struct RetType {
@@ -102,7 +104,9 @@ impl ast::DocCommentsOwner for StructDef {}
102impl StructDef { 104impl StructDef {
103 pub fn struct_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![struct]) } 105 pub fn struct_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![struct]) }
104 pub fn field_def_list(&self) -> Option<FieldDefList> { support::child(&self.syntax) } 106 pub fn field_def_list(&self) -> Option<FieldDefList> { support::child(&self.syntax) }
105 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 107 pub fn semicolon_token(&self) -> Option<SyntaxToken> {
108 support::token2(&self.syntax, T ! [ ; ])
109 }
106} 110}
107#[derive(Debug, Clone, PartialEq, Eq, Hash)] 111#[derive(Debug, Clone, PartialEq, Eq, Hash)]
108pub struct UnionDef { 112pub struct UnionDef {
@@ -328,7 +332,9 @@ impl ast::DocCommentsOwner for Module {}
328impl Module { 332impl Module {
329 pub fn mod_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![mod]) } 333 pub fn mod_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![mod]) }
330 pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) } 334 pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) }
331 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 335 pub fn semicolon_token(&self) -> Option<SyntaxToken> {
336 support::token2(&self.syntax, T ! [ ; ])
337 }
332} 338}
333#[derive(Debug, Clone, PartialEq, Eq, Hash)] 339#[derive(Debug, Clone, PartialEq, Eq, Hash)]
334pub struct ItemList { 340pub struct ItemList {
@@ -379,7 +385,9 @@ impl ConstDef {
379 pub fn const_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![const]) } 385 pub fn const_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![const]) }
380 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } 386 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) }
381 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } 387 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) }
382 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 388 pub fn semicolon_token(&self) -> Option<SyntaxToken> {
389 support::token2(&self.syntax, T ! [ ; ])
390 }
383} 391}
384#[derive(Debug, Clone, PartialEq, Eq, Hash)] 392#[derive(Debug, Clone, PartialEq, Eq, Hash)]
385pub struct StaticDef { 393pub struct StaticDef {
@@ -407,7 +415,9 @@ impl StaticDef {
407 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![mut]) } 415 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![mut]) }
408 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } 416 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) }
409 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } 417 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) }
410 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 418 pub fn semicolon_token(&self) -> Option<SyntaxToken> {
419 support::token2(&self.syntax, T ! [ ; ])
420 }
411} 421}
412#[derive(Debug, Clone, PartialEq, Eq, Hash)] 422#[derive(Debug, Clone, PartialEq, Eq, Hash)]
413pub struct TypeAliasDef { 423pub struct TypeAliasDef {
@@ -437,7 +447,9 @@ impl TypeAliasDef {
437 pub fn type_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![type]) } 447 pub fn type_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![type]) }
438 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } 448 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) }
439 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 449 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
440 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 450 pub fn semicolon_token(&self) -> Option<SyntaxToken> {
451 support::token2(&self.syntax, T ! [ ; ])
452 }
441} 453}
442#[derive(Debug, Clone, PartialEq, Eq, Hash)] 454#[derive(Debug, Clone, PartialEq, Eq, Hash)]
443pub struct ImplDef { 455pub struct ImplDef {
@@ -582,7 +594,9 @@ impl AstNode for ArrayType {
582impl ArrayType { 594impl ArrayType {
583 pub fn l_brack_token(&self) -> Option<LBrack> { support::token(&self.syntax) } 595 pub fn l_brack_token(&self) -> Option<LBrack> { support::token(&self.syntax) }
584 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 596 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
585 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 597 pub fn semicolon_token(&self) -> Option<SyntaxToken> {
598 support::token2(&self.syntax, T ! [ ; ])
599 }
586 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 600 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
587 pub fn r_brack_token(&self) -> Option<RBrack> { support::token(&self.syntax) } 601 pub fn r_brack_token(&self) -> Option<RBrack> { support::token(&self.syntax) }
588} 602}
@@ -765,7 +779,9 @@ impl ast::AttrsOwner for ArrayExpr {}
765impl ArrayExpr { 779impl ArrayExpr {
766 pub fn l_brack_token(&self) -> Option<LBrack> { support::token(&self.syntax) } 780 pub fn l_brack_token(&self) -> Option<LBrack> { support::token(&self.syntax) }
767 pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) } 781 pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) }
768 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 782 pub fn semicolon_token(&self) -> Option<SyntaxToken> {
783 support::token2(&self.syntax, T ! [ ; ])
784 }
769 pub fn r_brack_token(&self) -> Option<RBrack> { support::token(&self.syntax) } 785 pub fn r_brack_token(&self) -> Option<RBrack> { support::token(&self.syntax) }
770} 786}
771#[derive(Debug, Clone, PartialEq, Eq, Hash)] 787#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -1859,7 +1875,9 @@ impl MacroCall {
1859 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } 1875 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1860 pub fn excl_token(&self) -> Option<Excl> { support::token(&self.syntax) } 1876 pub fn excl_token(&self) -> Option<Excl> { support::token(&self.syntax) }
1861 pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } 1877 pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) }
1862 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 1878 pub fn semicolon_token(&self) -> Option<SyntaxToken> {
1879 support::token2(&self.syntax, T ! [ ; ])
1880 }
1863} 1881}
1864#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1882#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1865pub struct Attr { 1883pub struct Attr {
@@ -2100,7 +2118,9 @@ impl AstNode for ExprStmt {
2100impl ast::AttrsOwner for ExprStmt {} 2118impl ast::AttrsOwner for ExprStmt {}
2101impl ExprStmt { 2119impl ExprStmt {
2102 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 2120 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
2103 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 2121 pub fn semicolon_token(&self) -> Option<SyntaxToken> {
2122 support::token2(&self.syntax, T ! [ ; ])
2123 }
2104} 2124}
2105#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2125#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2106pub struct LetStmt { 2126pub struct LetStmt {
@@ -2124,7 +2144,9 @@ impl LetStmt {
2124 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } 2144 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
2125 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } 2145 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) }
2126 pub fn initializer(&self) -> Option<Expr> { support::child(&self.syntax) } 2146 pub fn initializer(&self) -> Option<Expr> { support::child(&self.syntax) }
2127 pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } 2147 pub fn semicolon_token(&self) -> Option<SyntaxToken> {
2148 support::token2(&self.syntax, T ! [ ; ])
2149 }
2128} 2150}
2129#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2151#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2130pub struct Condition { 2152pub struct Condition {