aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r--crates/ra_syntax/src/ast/generated.rs33
-rw-r--r--crates/ra_syntax/src/grammar.ron5
2 files changed, 37 insertions, 1 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index d0561c495..60480c699 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -17,6 +17,35 @@ use crate::{
17 ast::{self, AstNode}, 17 ast::{self, AstNode},
18}; 18};
19 19
20// Alias
21#[derive(Debug, PartialEq, Eq, Hash)]
22#[repr(transparent)]
23pub struct Alias {
24 pub(crate) syntax: SyntaxNode,
25}
26unsafe impl TransparentNewType for Alias {
27 type Repr = rowan::SyntaxNode<RaTypes>;
28}
29
30impl AstNode for Alias {
31 fn cast(syntax: &SyntaxNode) -> Option<&Self> {
32 match syntax.kind() {
33 ALIAS => Some(Alias::from_repr(syntax.into_repr())),
34 _ => None,
35 }
36 }
37 fn syntax(&self) -> &SyntaxNode { &self.syntax }
38}
39
40impl ToOwned for Alias {
41 type Owned = TreeArc<Alias>;
42 fn to_owned(&self) -> TreeArc<Alias> { TreeArc::cast(self.syntax.to_owned()) }
43}
44
45
46impl ast::NameOwner for Alias {}
47impl Alias {}
48
20// ArgList 49// ArgList
21#[derive(Debug, PartialEq, Eq, Hash)] 50#[derive(Debug, PartialEq, Eq, Hash)]
22#[repr(transparent)] 51#[repr(transparent)]
@@ -4176,6 +4205,10 @@ impl UseTree {
4176 pub fn use_tree_list(&self) -> Option<&UseTreeList> { 4205 pub fn use_tree_list(&self) -> Option<&UseTreeList> {
4177 super::child_opt(self) 4206 super::child_opt(self)
4178 } 4207 }
4208
4209 pub fn alias(&self) -> Option<&Alias> {
4210 super::child_opt(self)
4211 }
4179} 4212}
4180 4213
4181// UseTreeList 4214// UseTreeList
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron
index 47334bdf0..a2ccd7cb9 100644
--- a/crates/ra_syntax/src/grammar.ron
+++ b/crates/ra_syntax/src/grammar.ron
@@ -593,7 +593,10 @@ Grammar(
593 options: [ "UseTree" ] 593 options: [ "UseTree" ]
594 ), 594 ),
595 "UseTree": ( 595 "UseTree": (
596 options: [ "Path", "UseTreeList" ] 596 options: [ "Path", "UseTreeList", "Alias" ]
597 ),
598 "Alias": (
599 traits: ["NameOwner"],
597 ), 600 ),
598 "UseTreeList": ( 601 "UseTreeList": (
599 collections: [["use_trees", "UseTree"]] 602 collections: [["use_trees", "UseTree"]]