diff options
author | Aleksey Kladov <[email protected]> | 2018-12-28 10:27:30 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-12-28 10:27:30 +0000 |
commit | 072028e67996162f5a9da14cfd59ed64de5e8729 (patch) | |
tree | 6883b7d82c15653f6ad76f66bdbec8cdb5c5e8d8 /crates/ra_syntax/src/ast | |
parent | dc496d05160f9693a4e48977b7f7a3fe2689ac51 (diff) |
add macro-call node
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index c22e026cf..b0d2c3e20 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs | |||
@@ -1838,6 +1838,47 @@ impl<R: TreeRoot<RaTypes>> LoopExprNode<R> { | |||
1838 | impl<'a> ast::LoopBodyOwner<'a> for LoopExpr<'a> {} | 1838 | impl<'a> ast::LoopBodyOwner<'a> for LoopExpr<'a> {} |
1839 | impl<'a> LoopExpr<'a> {} | 1839 | impl<'a> LoopExpr<'a> {} |
1840 | 1840 | ||
1841 | // MacroCall | ||
1842 | #[derive(Debug, Clone, Copy,)] | ||
1843 | pub struct MacroCallNode<R: TreeRoot<RaTypes> = OwnedRoot> { | ||
1844 | pub(crate) syntax: SyntaxNode<R>, | ||
1845 | } | ||
1846 | pub type MacroCall<'a> = MacroCallNode<RefRoot<'a>>; | ||
1847 | |||
1848 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<MacroCallNode<R1>> for MacroCallNode<R2> { | ||
1849 | fn eq(&self, other: &MacroCallNode<R1>) -> bool { self.syntax == other.syntax } | ||
1850 | } | ||
1851 | impl<R: TreeRoot<RaTypes>> Eq for MacroCallNode<R> {} | ||
1852 | impl<R: TreeRoot<RaTypes>> Hash for MacroCallNode<R> { | ||
1853 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
1854 | } | ||
1855 | |||
1856 | impl<'a> AstNode<'a> for MacroCall<'a> { | ||
1857 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
1858 | match syntax.kind() { | ||
1859 | MACRO_CALL => Some(MacroCall { syntax }), | ||
1860 | _ => None, | ||
1861 | } | ||
1862 | } | ||
1863 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
1864 | } | ||
1865 | |||
1866 | impl<R: TreeRoot<RaTypes>> MacroCallNode<R> { | ||
1867 | pub fn borrowed(&self) -> MacroCall { | ||
1868 | MacroCallNode { syntax: self.syntax.borrowed() } | ||
1869 | } | ||
1870 | pub fn owned(&self) -> MacroCallNode { | ||
1871 | MacroCallNode { syntax: self.syntax.owned() } | ||
1872 | } | ||
1873 | } | ||
1874 | |||
1875 | |||
1876 | impl<'a> MacroCall<'a> { | ||
1877 | pub fn token_tree(self) -> Option<TokenTree<'a>> { | ||
1878 | super::child_opt(self) | ||
1879 | } | ||
1880 | } | ||
1881 | |||
1841 | // MatchArm | 1882 | // MatchArm |
1842 | #[derive(Debug, Clone, Copy,)] | 1883 | #[derive(Debug, Clone, Copy,)] |
1843 | pub struct MatchArmNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 1884 | pub struct MatchArmNode<R: TreeRoot<RaTypes> = OwnedRoot> { |