diff options
author | Florian Diebold <[email protected]> | 2019-02-01 23:18:10 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2019-02-01 23:23:53 +0000 |
commit | 5a7fce4e4cd8846a49ce007910f72340007d9c8c (patch) | |
tree | 7ec654f142d821e5ad5f9347bb84367fef0943d6 /crates/ra_syntax/src/ast/generated.rs | |
parent | aa5f6a1ee8b56343e9f3dc9b1578d56f29dd2bc8 (diff) |
Pass aliases to ImportData
Diffstat (limited to 'crates/ra_syntax/src/ast/generated.rs')
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index d0561c495..60480c699 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs | |||
@@ -17,6 +17,35 @@ use crate::{ | |||
17 | ast::{self, AstNode}, | 17 | ast::{self, AstNode}, |
18 | }; | 18 | }; |
19 | 19 | ||
20 | // Alias | ||
21 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
22 | #[repr(transparent)] | ||
23 | pub struct Alias { | ||
24 | pub(crate) syntax: SyntaxNode, | ||
25 | } | ||
26 | unsafe impl TransparentNewType for Alias { | ||
27 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
28 | } | ||
29 | |||
30 | impl AstNode for Alias { | ||
31 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
32 | match syntax.kind() { | ||
33 | ALIAS => Some(Alias::from_repr(syntax.into_repr())), | ||
34 | _ => None, | ||
35 | } | ||
36 | } | ||
37 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
38 | } | ||
39 | |||
40 | impl ToOwned for Alias { | ||
41 | type Owned = TreeArc<Alias>; | ||
42 | fn to_owned(&self) -> TreeArc<Alias> { TreeArc::cast(self.syntax.to_owned()) } | ||
43 | } | ||
44 | |||
45 | |||
46 | impl ast::NameOwner for Alias {} | ||
47 | impl Alias {} | ||
48 | |||
20 | // ArgList | 49 | // ArgList |
21 | #[derive(Debug, PartialEq, Eq, Hash)] | 50 | #[derive(Debug, PartialEq, Eq, Hash)] |
22 | #[repr(transparent)] | 51 | #[repr(transparent)] |
@@ -4176,6 +4205,10 @@ impl UseTree { | |||
4176 | pub fn use_tree_list(&self) -> Option<&UseTreeList> { | 4205 | pub fn use_tree_list(&self) -> Option<&UseTreeList> { |
4177 | super::child_opt(self) | 4206 | super::child_opt(self) |
4178 | } | 4207 | } |
4208 | |||
4209 | pub fn alias(&self) -> Option<&Alias> { | ||
4210 | super::child_opt(self) | ||
4211 | } | ||
4179 | } | 4212 | } |
4180 | 4213 | ||
4181 | // UseTreeList | 4214 | // UseTreeList |