aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src/yellow/syntax.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/libsyntax2/src/yellow/syntax.rs')
-rw-r--r--crates/libsyntax2/src/yellow/syntax.rs16
1 files changed, 10 insertions, 6 deletions
diff --git a/crates/libsyntax2/src/yellow/syntax.rs b/crates/libsyntax2/src/yellow/syntax.rs
index ef82ba408..87e4a159d 100644
--- a/crates/libsyntax2/src/yellow/syntax.rs
+++ b/crates/libsyntax2/src/yellow/syntax.rs
@@ -71,12 +71,16 @@ impl<R: TreeRoot> SyntaxNode<R> {
71 self.red().green().text() 71 self.red().green().text()
72 } 72 }
73 73
74 pub fn children<'a>(&'a self) -> impl Iterator<Item = SyntaxNode<R>> + 'a { 74 pub fn children(&self) -> impl Iterator<Item = SyntaxNode<R>> {
75 let red = self.red(); 75 let red = self.red;
76 let n_children = red.n_children(); 76 let n_children = self.red().n_children();
77 (0..n_children).map(move |i| SyntaxNode { 77 let root = self.root.clone();
78 root: self.root.clone(), 78 (0..n_children).map(move |i| {
79 red: red.get_child(i).unwrap(), 79 let red = unsafe { red.get(&root) };
80 SyntaxNode {
81 root: root.clone(),
82 red: red.get_child(i).unwrap(),
83 }
80 }) 84 })
81 } 85 }
82 86