diff options
author | Marcus Klaas de Vries <[email protected]> | 2019-01-10 12:54:58 +0000 |
---|---|---|
committer | Marcus Klaas de Vries <[email protected]> | 2019-01-14 12:52:55 +0000 |
commit | a6146d35b1615cf5fb908b29f34e58bfde3bf96d (patch) | |
tree | 70613ee98eee67c1df6aff1e663be75a33c348f4 /crates/ra_syntax/src/yellow.rs | |
parent | 8caff4e03475c20392f13e8c6ad469bd01a4b4ce (diff) |
Implement type inference for literals (WIP)
Diffstat (limited to 'crates/ra_syntax/src/yellow.rs')
-rw-r--r-- | crates/ra_syntax/src/yellow.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/yellow.rs b/crates/ra_syntax/src/yellow.rs index 93621d08a..03df00fc6 100644 --- a/crates/ra_syntax/src/yellow.rs +++ b/crates/ra_syntax/src/yellow.rs | |||
@@ -128,40 +128,52 @@ impl SyntaxNode { | |||
128 | pub(crate) fn root_data(&self) -> &Vec<SyntaxError> { | 128 | pub(crate) fn root_data(&self) -> &Vec<SyntaxError> { |
129 | self.0.root_data() | 129 | self.0.root_data() |
130 | } | 130 | } |
131 | |||
131 | pub(crate) fn replace_with(&self, replacement: GreenNode) -> GreenNode { | 132 | pub(crate) fn replace_with(&self, replacement: GreenNode) -> GreenNode { |
132 | self.0.replace_self(replacement) | 133 | self.0.replace_self(replacement) |
133 | } | 134 | } |
135 | |||
134 | pub fn to_owned(&self) -> TreeArc<SyntaxNode> { | 136 | pub fn to_owned(&self) -> TreeArc<SyntaxNode> { |
135 | let ptr = TreeArc(self.0.to_owned()); | 137 | let ptr = TreeArc(self.0.to_owned()); |
136 | TreeArc::cast(ptr) | 138 | TreeArc::cast(ptr) |
137 | } | 139 | } |
140 | |||
138 | pub fn kind(&self) -> SyntaxKind { | 141 | pub fn kind(&self) -> SyntaxKind { |
139 | self.0.kind() | 142 | self.0.kind() |
140 | } | 143 | } |
144 | |||
141 | pub fn range(&self) -> TextRange { | 145 | pub fn range(&self) -> TextRange { |
142 | self.0.range() | 146 | self.0.range() |
143 | } | 147 | } |
148 | |||
144 | pub fn text(&self) -> SyntaxText { | 149 | pub fn text(&self) -> SyntaxText { |
145 | SyntaxText::new(self) | 150 | SyntaxText::new(self) |
146 | } | 151 | } |
152 | |||
147 | pub fn is_leaf(&self) -> bool { | 153 | pub fn is_leaf(&self) -> bool { |
148 | self.0.is_leaf() | 154 | self.0.is_leaf() |
149 | } | 155 | } |
156 | |||
150 | pub fn parent(&self) -> Option<&SyntaxNode> { | 157 | pub fn parent(&self) -> Option<&SyntaxNode> { |
151 | self.0.parent().map(SyntaxNode::from_repr) | 158 | self.0.parent().map(SyntaxNode::from_repr) |
152 | } | 159 | } |
160 | |||
153 | pub fn first_child(&self) -> Option<&SyntaxNode> { | 161 | pub fn first_child(&self) -> Option<&SyntaxNode> { |
154 | self.0.first_child().map(SyntaxNode::from_repr) | 162 | self.0.first_child().map(SyntaxNode::from_repr) |
155 | } | 163 | } |
164 | |||
156 | pub fn last_child(&self) -> Option<&SyntaxNode> { | 165 | pub fn last_child(&self) -> Option<&SyntaxNode> { |
157 | self.0.last_child().map(SyntaxNode::from_repr) | 166 | self.0.last_child().map(SyntaxNode::from_repr) |
158 | } | 167 | } |
168 | |||
159 | pub fn next_sibling(&self) -> Option<&SyntaxNode> { | 169 | pub fn next_sibling(&self) -> Option<&SyntaxNode> { |
160 | self.0.next_sibling().map(SyntaxNode::from_repr) | 170 | self.0.next_sibling().map(SyntaxNode::from_repr) |
161 | } | 171 | } |
172 | |||
162 | pub fn prev_sibling(&self) -> Option<&SyntaxNode> { | 173 | pub fn prev_sibling(&self) -> Option<&SyntaxNode> { |
163 | self.0.prev_sibling().map(SyntaxNode::from_repr) | 174 | self.0.prev_sibling().map(SyntaxNode::from_repr) |
164 | } | 175 | } |
176 | |||
165 | pub fn children(&self) -> SyntaxNodeChildren { | 177 | pub fn children(&self) -> SyntaxNodeChildren { |
166 | SyntaxNodeChildren(self.0.children()) | 178 | SyntaxNodeChildren(self.0.children()) |
167 | } | 179 | } |