aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/libsyntax2/src')
-rw-r--r--crates/libsyntax2/src/ast/mod.rs2
-rw-r--r--crates/libsyntax2/src/yellow/syntax.rs9
2 files changed, 9 insertions, 2 deletions
diff --git a/crates/libsyntax2/src/ast/mod.rs b/crates/libsyntax2/src/ast/mod.rs
index 46509b5ec..5b9a07db4 100644
--- a/crates/libsyntax2/src/ast/mod.rs
+++ b/crates/libsyntax2/src/ast/mod.rs
@@ -46,7 +46,7 @@ impl ParsedFile {
46 File::cast(self.syntax()).unwrap() 46 File::cast(self.syntax()).unwrap()
47 } 47 }
48 pub fn syntax(&self) -> SyntaxNodeRef { 48 pub fn syntax(&self) -> SyntaxNodeRef {
49 self.root.as_ref() 49 self.root.borrowed()
50 } 50 }
51 pub fn errors(&self) -> Vec<SyntaxError> { 51 pub fn errors(&self) -> Vec<SyntaxError> {
52 self.syntax().root.syntax_root().errors.clone() 52 self.syntax().root.syntax_root().errors.clone()
diff --git a/crates/libsyntax2/src/yellow/syntax.rs b/crates/libsyntax2/src/yellow/syntax.rs
index 87e4a159d..8f1b1d79a 100644
--- a/crates/libsyntax2/src/yellow/syntax.rs
+++ b/crates/libsyntax2/src/yellow/syntax.rs
@@ -51,13 +51,20 @@ impl SyntaxNode<OwnedRoot> {
51} 51}
52 52
53impl<R: TreeRoot> SyntaxNode<R> { 53impl<R: TreeRoot> SyntaxNode<R> {
54 pub fn as_ref<'a>(&'a self) -> SyntaxNode<RefRoot<'a>> { 54 pub fn borrowed<'a>(&'a self) -> SyntaxNodeRef<'a> {
55 SyntaxNode { 55 SyntaxNode {
56 root: self.root.borrowed(), 56 root: self.root.borrowed(),
57 red: self.red, 57 red: self.red,
58 } 58 }
59 } 59 }
60 60
61 pub fn owned<'a>(&'a self) -> SyntaxNode {
62 SyntaxNode {
63 root: self.root.owned(),
64 red: self.red,
65 }
66 }
67
61 pub fn kind(&self) -> SyntaxKind { 68 pub fn kind(&self) -> SyntaxKind {
62 self.red().green().kind() 69 self.red().green().kind()
63 } 70 }