mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
initial mod resolve
This commit is contained in:
parent
55e87e0b74
commit
081c16c776
6 changed files with 111 additions and 23 deletions
|
@ -89,7 +89,15 @@ impl<R: TreeRoot> SyntaxNode<R> {
|
|||
}
|
||||
|
||||
pub fn first_child(&self) -> Option<SyntaxNode<R>> {
|
||||
self.children().next()
|
||||
let red = self.red().get_child(0)?;
|
||||
Some(SyntaxNode { root: self.root.clone(), red })
|
||||
}
|
||||
|
||||
pub fn last_child(&self) -> Option<SyntaxNode<R>> {
|
||||
let n = self.red().n_children();
|
||||
let n = n.checked_sub(1)?;
|
||||
let red = self.red().get_child(n)?;
|
||||
Some(SyntaxNode { root: self.root.clone(), red })
|
||||
}
|
||||
|
||||
pub fn next_sibling(&self) -> Option<SyntaxNode<R>> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue