aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/yellow.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/yellow.rs')
-rw-r--r--crates/ra_syntax/src/yellow.rs34
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 {
21pub type GreenNode = rowan::GreenNode<RaTypes>; 21pub type GreenNode = rowan::GreenNode<RaTypes>;
22 22
23#[derive(PartialEq, Eq, Hash)] 23#[derive(PartialEq, Eq, Hash)]
24pub struct TreePtr<T: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>>( 24pub 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
28impl<T> TreePtr<T> 28impl<T> TreeArc<T>
29where 29where
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
40impl<T> std::ops::Deref for TreePtr<T> 40impl<T> std::ops::Deref for TreeArc<T>
41where 41where
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
50impl<T> PartialEq<T> for TreePtr<T> 50impl<T> PartialEq<T> for TreeArc<T>
51where 51where
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
61impl<T> Clone for TreePtr<T> 61impl<T> Clone for TreeArc<T>
62where 62where
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
70impl<T> fmt::Debug for TreePtr<T> 70impl<T> fmt::Debug for TreeArc<T>
71where 71where
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
87impl SyntaxNode { 87impl 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()