diff options
Diffstat (limited to 'crates/ra_syntax/src/yellow.rs')
-rw-r--r-- | crates/ra_syntax/src/yellow.rs | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/crates/ra_syntax/src/yellow.rs b/crates/ra_syntax/src/yellow.rs index 1bf1806b9..93621d08a 100644 --- a/crates/ra_syntax/src/yellow.rs +++ b/crates/ra_syntax/src/yellow.rs | |||
@@ -21,23 +21,23 @@ impl Types for RaTypes { | |||
21 | pub type GreenNode = rowan::GreenNode<RaTypes>; | 21 | pub type GreenNode = rowan::GreenNode<RaTypes>; |
22 | 22 | ||
23 | #[derive(PartialEq, Eq, Hash)] | 23 | #[derive(PartialEq, Eq, Hash)] |
24 | pub struct TreePtr<T: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>>( | 24 | pub struct TreeArc<T: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>>( |
25 | pub(crate) rowan::TreePtr<RaTypes, T>, | 25 | pub(crate) rowan::TreeArc<RaTypes, T>, |
26 | ); | 26 | ); |
27 | 27 | ||
28 | impl<T> TreePtr<T> | 28 | impl<T> TreeArc<T> |
29 | where | 29 | where |
30 | T: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>, | 30 | T: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>, |
31 | { | 31 | { |
32 | pub(crate) fn cast<U>(this: TreePtr<T>) -> TreePtr<U> | 32 | pub(crate) fn cast<U>(this: TreeArc<T>) -> TreeArc<U> |
33 | where | 33 | where |
34 | U: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>, | 34 | U: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>, |
35 | { | 35 | { |
36 | TreePtr(rowan::TreePtr::cast(this.0)) | 36 | TreeArc(rowan::TreeArc::cast(this.0)) |
37 | } | 37 | } |
38 | } | 38 | } |
39 | 39 | ||
40 | impl<T> std::ops::Deref for TreePtr<T> | 40 | impl<T> std::ops::Deref for TreeArc<T> |
41 | where | 41 | where |
42 | T: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>, | 42 | T: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>, |
43 | { | 43 | { |
@@ -47,7 +47,7 @@ where | |||
47 | } | 47 | } |
48 | } | 48 | } |
49 | 49 | ||
50 | impl<T> PartialEq<T> for TreePtr<T> | 50 | impl<T> PartialEq<T> for TreeArc<T> |
51 | where | 51 | where |
52 | T: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>, | 52 | T: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>, |
53 | T: PartialEq<T>, | 53 | T: PartialEq<T>, |
@@ -58,16 +58,16 @@ where | |||
58 | } | 58 | } |
59 | } | 59 | } |
60 | 60 | ||
61 | impl<T> Clone for TreePtr<T> | 61 | impl<T> Clone for TreeArc<T> |
62 | where | 62 | where |
63 | T: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>, | 63 | T: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>, |
64 | { | 64 | { |
65 | fn clone(&self) -> TreePtr<T> { | 65 | fn clone(&self) -> TreeArc<T> { |
66 | TreePtr(self.0.clone()) | 66 | TreeArc(self.0.clone()) |
67 | } | 67 | } |
68 | } | 68 | } |
69 | 69 | ||
70 | impl<T> fmt::Debug for TreePtr<T> | 70 | impl<T> fmt::Debug for TreeArc<T> |
71 | where | 71 | where |
72 | T: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>, | 72 | T: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>, |
73 | T: fmt::Debug, | 73 | T: fmt::Debug, |
@@ -85,9 +85,9 @@ unsafe impl TransparentNewType for SyntaxNode { | |||
85 | } | 85 | } |
86 | 86 | ||
87 | impl SyntaxNode { | 87 | impl SyntaxNode { |
88 | pub(crate) fn new(green: GreenNode, errors: Vec<SyntaxError>) -> TreePtr<SyntaxNode> { | 88 | pub(crate) fn new(green: GreenNode, errors: Vec<SyntaxError>) -> TreeArc<SyntaxNode> { |
89 | let ptr = TreePtr(rowan::SyntaxNode::new(green, errors)); | 89 | let ptr = TreeArc(rowan::SyntaxNode::new(green, errors)); |
90 | TreePtr::cast(ptr) | 90 | TreeArc::cast(ptr) |
91 | } | 91 | } |
92 | } | 92 | } |
93 | 93 | ||
@@ -131,9 +131,9 @@ impl SyntaxNode { | |||
131 | pub(crate) fn replace_with(&self, replacement: GreenNode) -> GreenNode { | 131 | pub(crate) fn replace_with(&self, replacement: GreenNode) -> GreenNode { |
132 | self.0.replace_self(replacement) | 132 | self.0.replace_self(replacement) |
133 | } | 133 | } |
134 | pub fn to_owned(&self) -> TreePtr<SyntaxNode> { | 134 | pub fn to_owned(&self) -> TreeArc<SyntaxNode> { |
135 | let ptr = TreePtr(self.0.to_owned()); | 135 | let ptr = TreeArc(self.0.to_owned()); |
136 | TreePtr::cast(ptr) | 136 | TreeArc::cast(ptr) |
137 | } | 137 | } |
138 | pub fn kind(&self) -> SyntaxKind { | 138 | pub fn kind(&self) -> SyntaxKind { |
139 | self.0.kind() | 139 | self.0.kind() |