aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
authorveetaha <[email protected]>2020-05-12 21:33:56 +0100
committerveetaha <[email protected]>2020-05-12 21:45:29 +0100
commit55a29982c014a57867a540ccc0161ef983cfcf46 (patch)
tree940da5c636928e33aa19b195ba7312d3f4d88cbc /crates/ra_syntax
parent24b27abf9f3a57268d0fb7c9a1aa2ede2980195f (diff)
Revert "Remove MacroStmts as per edwin0cheng" (cc @edwin0cheng) and add a fixme to document it.
This reverts commit 7a49165f5d5c8186edd04f874eae8a98e39d3df6. MacroStmts ast node is not used by itself, but it pertains to SyntaxNodeKind MACRO_STMTS that is used by ra_paser, so even tho the node itself is not used, it is better to keep it with a FIXME to actually add a doc comment when it becomes useful.
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r--crates/ra_syntax/src/ast/generated/nodes.rs32
1 files changed, 32 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}
2492impl ast::ModuleItemOwner for MacroItems {} 2492impl ast::ModuleItemOwner for MacroItems {}
2493impl MacroItems {} 2493impl 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)]
2503pub struct MacroStmts {
2504 pub(crate) syntax: SyntaxNode,
2505}
2506impl 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}
4066impl 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}
4050impl AstNode for ExternItemList { 4077impl 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}
5509impl 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}
5482impl std::fmt::Display for ExternItemList { 5514impl 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)