Skip to content

Commit

Permalink
Api needs to also give ArcBorrow<Node>
Browse files Browse the repository at this point in the history
  • Loading branch information
CAD97 committed Apr 29, 2020
1 parent a8a3f1c commit f39b846
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion examples/s_expressions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,8 @@ impl Atom {
Some(op)
}
fn text(&self) -> &str {
match self.0.green().children().next() {
let green = self.0.green();
match ArcBorrow::downgrade(green).children().next() {
Some(rowan::NodeOrToken::Token(token)) => ArcBorrow::downgrade(token).text(),
_ => unreachable!(),
}
Expand Down
4 changes: 2 additions & 2 deletions src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ impl<L: Language> SyntaxNode<L> {
self.raw.text()
}

pub fn green(&self) -> &GreenNode {
ArcBorrow::downgrade(self.raw.green())
pub fn green(&self) -> ArcBorrow<'_, GreenNode> {
self.raw.green()
}

pub fn parent(&self) -> Option<SyntaxNode<L>> {
Expand Down

0 comments on commit f39b846

Please sign in to comment.