diff options
-rw-r--r-- | crates/ra_syntax/src/ast/generated/nodes.rs | 36 | ||||
-rw-r--r-- | xtask/src/codegen/rust.ungram | 5 |
2 files changed, 20 insertions, 21 deletions
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 05f75871d..c20ff53bf 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs | |||
@@ -322,9 +322,9 @@ pub struct ParamList { | |||
322 | } | 322 | } |
323 | impl ParamList { | 323 | impl ParamList { |
324 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | 324 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
325 | pub fn params(&self) -> AstChildren<Param> { support::children(&self.syntax) } | ||
326 | pub fn self_param(&self) -> Option<SelfParam> { support::child(&self.syntax) } | 325 | pub fn self_param(&self) -> Option<SelfParam> { support::child(&self.syntax) } |
327 | pub fn comma_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![,]) } | 326 | pub fn comma_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![,]) } |
327 | pub fn params(&self) -> AstChildren<Param> { support::children(&self.syntax) } | ||
328 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | 328 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
329 | } | 329 | } |
330 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 330 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -357,17 +357,6 @@ impl BlockExpr { | |||
357 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | 357 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
358 | } | 358 | } |
359 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 359 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
360 | pub struct Param { | ||
361 | pub(crate) syntax: SyntaxNode, | ||
362 | } | ||
363 | impl ast::AttrsOwner for Param {} | ||
364 | impl ast::TypeAscriptionOwner for Param {} | ||
365 | impl Param { | ||
366 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
367 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | ||
368 | pub fn dotdotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![...]) } | ||
369 | } | ||
370 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
371 | pub struct SelfParam { | 360 | pub struct SelfParam { |
372 | pub(crate) syntax: SyntaxNode, | 361 | pub(crate) syntax: SyntaxNode, |
373 | } | 362 | } |
@@ -383,6 +372,17 @@ impl SelfParam { | |||
383 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | 372 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } |
384 | } | 373 | } |
385 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 374 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
375 | pub struct Param { | ||
376 | pub(crate) syntax: SyntaxNode, | ||
377 | } | ||
378 | impl ast::AttrsOwner for Param {} | ||
379 | impl ast::TypeAscriptionOwner for Param {} | ||
380 | impl Param { | ||
381 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
382 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | ||
383 | pub fn dotdotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![...]) } | ||
384 | } | ||
385 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
386 | pub struct TypeBoundList { | 386 | pub struct TypeBoundList { |
387 | pub(crate) syntax: SyntaxNode, | 387 | pub(crate) syntax: SyntaxNode, |
388 | } | 388 | } |
@@ -1724,8 +1724,8 @@ impl AstNode for BlockExpr { | |||
1724 | } | 1724 | } |
1725 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1725 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1726 | } | 1726 | } |
1727 | impl AstNode for Param { | 1727 | impl AstNode for SelfParam { |
1728 | fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM } | 1728 | fn can_cast(kind: SyntaxKind) -> bool { kind == SELF_PARAM } |
1729 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1729 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1730 | if Self::can_cast(syntax.kind()) { | 1730 | if Self::can_cast(syntax.kind()) { |
1731 | Some(Self { syntax }) | 1731 | Some(Self { syntax }) |
@@ -1735,8 +1735,8 @@ impl AstNode for Param { | |||
1735 | } | 1735 | } |
1736 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1736 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1737 | } | 1737 | } |
1738 | impl AstNode for SelfParam { | 1738 | impl AstNode for Param { |
1739 | fn can_cast(kind: SyntaxKind) -> bool { kind == SELF_PARAM } | 1739 | fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM } |
1740 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1740 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1741 | if Self::can_cast(syntax.kind()) { | 1741 | if Self::can_cast(syntax.kind()) { |
1742 | Some(Self { syntax }) | 1742 | Some(Self { syntax }) |
@@ -3599,12 +3599,12 @@ impl std::fmt::Display for BlockExpr { | |||
3599 | std::fmt::Display::fmt(self.syntax(), f) | 3599 | std::fmt::Display::fmt(self.syntax(), f) |
3600 | } | 3600 | } |
3601 | } | 3601 | } |
3602 | impl std::fmt::Display for Param { | 3602 | impl std::fmt::Display for SelfParam { |
3603 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3603 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3604 | std::fmt::Display::fmt(self.syntax(), f) | 3604 | std::fmt::Display::fmt(self.syntax(), f) |
3605 | } | 3605 | } |
3606 | } | 3606 | } |
3607 | impl std::fmt::Display for SelfParam { | 3607 | impl std::fmt::Display for Param { |
3608 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3608 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3609 | std::fmt::Display::fmt(self.syntax(), f) | 3609 | std::fmt::Display::fmt(self.syntax(), f) |
3610 | } | 3610 | } |
diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram index 42ef2fb82..8c4f953b0 100644 --- a/xtask/src/codegen/rust.ungram +++ b/xtask/src/codegen/rust.ungram | |||
@@ -54,9 +54,8 @@ Abi = | |||
54 | 54 | ||
55 | ParamList = | 55 | ParamList = |
56 | '('( | 56 | '('( |
57 | (Param (',' Param)* ','?)? | 57 | SelfParam |
58 | | SelfParam ','? | 58 | | (SelfParam ',')? (Param (',' Param)* ','?)? |
59 | | SelfParam ',' (Param (',' Param)* ','?) | ||
60 | )')' | 59 | )')' |
61 | 60 | ||
62 | SelfParam = | 61 | SelfParam = |