diff options
-rw-r--r-- | crates/ra_syntax/src/ast/generated/nodes.rs | 32 | ||||
-rw-r--r-- | xtask/src/ast_src.rs | 13 |
2 files changed, 45 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 7b236cd52..5dad028c7 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs | |||
@@ -2491,6 +2491,22 @@ pub struct MacroItems { | |||
2491 | } | 2491 | } |
2492 | impl ast::ModuleItemOwner for MacroItems {} | 2492 | impl ast::ModuleItemOwner for MacroItems {} |
2493 | impl MacroItems {} | 2493 | impl MacroItems {} |
2494 | /// FIXME: (@edwin0cheng) add some documentation here. As per the writing | ||
2495 | /// of this comment this ast node is not used. | ||
2496 | /// | ||
2497 | /// ``` | ||
2498 | /// // FIXME: example here | ||
2499 | /// ``` | ||
2500 | /// | ||
2501 | /// [Reference](https://doc.rust-lang.org/reference/macros.html) | ||
2502 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2503 | pub struct MacroStmts { | ||
2504 | pub(crate) syntax: SyntaxNode, | ||
2505 | } | ||
2506 | impl MacroStmts { | ||
2507 | pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } | ||
2508 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
2509 | } | ||
2494 | /// List of items in an extern block. | 2510 | /// List of items in an extern block. |
2495 | /// | 2511 | /// |
2496 | /// ``` | 2512 | /// ``` |
@@ -4047,6 +4063,17 @@ impl AstNode for MacroItems { | |||
4047 | } | 4063 | } |
4048 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 4064 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
4049 | } | 4065 | } |
4066 | impl AstNode for MacroStmts { | ||
4067 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_STMTS } | ||
4068 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
4069 | if Self::can_cast(syntax.kind()) { | ||
4070 | Some(Self { syntax }) | ||
4071 | } else { | ||
4072 | None | ||
4073 | } | ||
4074 | } | ||
4075 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
4076 | } | ||
4050 | impl AstNode for ExternItemList { | 4077 | impl AstNode for ExternItemList { |
4051 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_ITEM_LIST } | 4078 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_ITEM_LIST } |
4052 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 4079 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -5479,6 +5506,11 @@ impl std::fmt::Display for MacroItems { | |||
5479 | std::fmt::Display::fmt(self.syntax(), f) | 5506 | std::fmt::Display::fmt(self.syntax(), f) |
5480 | } | 5507 | } |
5481 | } | 5508 | } |
5509 | impl std::fmt::Display for MacroStmts { | ||
5510 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
5511 | std::fmt::Display::fmt(self.syntax(), f) | ||
5512 | } | ||
5513 | } | ||
5482 | impl std::fmt::Display for ExternItemList { | 5514 | impl std::fmt::Display for ExternItemList { |
5483 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5515 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
5484 | std::fmt::Display::fmt(self.syntax(), f) | 5516 | std::fmt::Display::fmt(self.syntax(), f) |
diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs index 79e5a608d..80b6967b8 100644 --- a/xtask/src/ast_src.rs +++ b/xtask/src/ast_src.rs | |||
@@ -2016,6 +2016,19 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { | |||
2016 | /// [Reference](https://doc.rust-lang.org/reference/macros.html) | 2016 | /// [Reference](https://doc.rust-lang.org/reference/macros.html) |
2017 | struct MacroItems: ModuleItemOwner { } | 2017 | struct MacroItems: ModuleItemOwner { } |
2018 | 2018 | ||
2019 | /// FIXME: (@edwin0cheng) add some documentation here. As per the writing | ||
2020 | /// of this comment this ast node is not used. | ||
2021 | /// | ||
2022 | /// ``` | ||
2023 | /// // FIXME: example here | ||
2024 | /// ``` | ||
2025 | /// | ||
2026 | /// [Reference](https://doc.rust-lang.org/reference/macros.html) | ||
2027 | struct MacroStmts { | ||
2028 | statements: [Stmt], | ||
2029 | Expr, | ||
2030 | } | ||
2031 | |||
2019 | /// List of items in an extern block. | 2032 | /// List of items in an extern block. |
2020 | /// | 2033 | /// |
2021 | /// ``` | 2034 | /// ``` |