This commit is contained in:
Mikhail Rakhmanov 2020-06-11 14:32:14 +02:00
parent 9f91901f7e
commit eb4004fdb8

View file

@ -100,7 +100,8 @@ fn previous_non_triva_element(element: SyntaxElement) -> Option<SyntaxElement> {
})?; })?;
non_trivia_sibling(NodeOrToken::Node(prev_sibling_node), Direction::Prev)? non_trivia_sibling(NodeOrToken::Node(prev_sibling_node), Direction::Prev)?
}; };
//I think you can avoid this loop if you use SyntaxToken::prev_token -- unlike prev_sibling_or_token, it works across parents. // TODO: Check if this can be simplified
// Matklad: I think you can avoid this loop if you use SyntaxToken::prev_token -- unlike prev_sibling_or_token, it works across parents.
// traversing the tree down to get the last token or node, i.e. the closest one // traversing the tree down to get the last token or node, i.e. the closest one
loop { loop {
if let Some(token) = wrapped.as_token() { if let Some(token) = wrapped.as_token() {