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/grammar/expressions.rs2
-rw-r--r--crates/ra_syntax/src/grammar/expressions/atom.rs36
-rw-r--r--crates/ra_syntax/src/ptr.rs8
3 files changed, 22 insertions, 24 deletions
diff --git a/crates/ra_syntax/src/grammar/expressions.rs b/crates/ra_syntax/src/grammar/expressions.rs
index 2236555e0..7ee32fa7c 100644
--- a/crates/ra_syntax/src/grammar/expressions.rs
+++ b/crates/ra_syntax/src/grammar/expressions.rs
@@ -305,6 +305,8 @@ fn postfix_expr(
305// fn foo() { 305// fn foo() {
306// let _ = f(); 306// let _ = f();
307// let _ = f()(1)(1, 2,); 307// let _ = f()(1)(1, 2,);
308// let _ = f(<Foo>::func());
309// f(<Foo as Trait>::func());
308// } 310// }
309fn call_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { 311fn call_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker {
310 assert!(p.at(L_PAREN)); 312 assert!(p.at(L_PAREN));
diff --git a/crates/ra_syntax/src/grammar/expressions/atom.rs b/crates/ra_syntax/src/grammar/expressions/atom.rs
index 167a76551..6d6d89f70 100644
--- a/crates/ra_syntax/src/grammar/expressions/atom.rs
+++ b/crates/ra_syntax/src/grammar/expressions/atom.rs
@@ -36,26 +36,22 @@ pub(crate) fn literal(p: &mut Parser) -> Option<CompletedMarker> {
36} 36}
37 37
38// E.g. for after the break in `if break {}`, this should not match 38// E.g. for after the break in `if break {}`, this should not match
39pub(super) const ATOM_EXPR_FIRST: TokenSet = LITERAL_FIRST.union(token_set![ 39pub(super) const ATOM_EXPR_FIRST: TokenSet =
40 L_PAREN, 40 LITERAL_FIRST.union(paths::PATH_FIRST).union(token_set![
41 L_CURLY, 41 L_PAREN,
42 L_BRACK, 42 L_CURLY,
43 PIPE, 43 L_BRACK,
44 MOVE_KW, 44 PIPE,
45 IF_KW, 45 MOVE_KW,
46 WHILE_KW, 46 IF_KW,
47 MATCH_KW, 47 WHILE_KW,
48 UNSAFE_KW, 48 MATCH_KW,
49 RETURN_KW, 49 UNSAFE_KW,
50 IDENT, 50 RETURN_KW,
51 SELF_KW, 51 BREAK_KW,
52 SUPER_KW, 52 CONTINUE_KW,
53 CRATE_KW, 53 LIFETIME,
54 COLONCOLON, 54 ]);
55 BREAK_KW,
56 CONTINUE_KW,
57 LIFETIME,
58]);
59 55
60const EXPR_RECOVERY_SET: TokenSet = token_set![LET_KW]; 56const EXPR_RECOVERY_SET: TokenSet = token_set![LET_KW];
61 57
diff --git a/crates/ra_syntax/src/ptr.rs b/crates/ra_syntax/src/ptr.rs
index b50cd8a52..13ee1305f 100644
--- a/crates/ra_syntax/src/ptr.rs
+++ b/crates/ra_syntax/src/ptr.rs
@@ -42,7 +42,7 @@ impl SyntaxNodePtr {
42/// Like `SyntaxNodePtr`, but remembers the type of node 42/// Like `SyntaxNodePtr`, but remembers the type of node
43#[derive(Debug, PartialEq, Eq, Hash)] 43#[derive(Debug, PartialEq, Eq, Hash)]
44pub struct AstPtr<N: AstNode> { 44pub struct AstPtr<N: AstNode> {
45 ptr: SyntaxNodePtr, 45 raw: SyntaxNodePtr,
46 _ty: PhantomData<N>, 46 _ty: PhantomData<N>,
47} 47}
48 48
@@ -56,18 +56,18 @@ impl<N: AstNode> Clone for AstPtr<N> {
56impl<N: AstNode> AstPtr<N> { 56impl<N: AstNode> AstPtr<N> {
57 pub fn new(node: &N) -> AstPtr<N> { 57 pub fn new(node: &N) -> AstPtr<N> {
58 AstPtr { 58 AstPtr {
59 ptr: SyntaxNodePtr::new(node.syntax()), 59 raw: SyntaxNodePtr::new(node.syntax()),
60 _ty: PhantomData, 60 _ty: PhantomData,
61 } 61 }
62 } 62 }
63 63
64 pub fn to_node(self, source_file: &SourceFile) -> &N { 64 pub fn to_node(self, source_file: &SourceFile) -> &N {
65 let syntax_node = self.ptr.to_node(source_file); 65 let syntax_node = self.raw.to_node(source_file);
66 N::cast(syntax_node).unwrap() 66 N::cast(syntax_node).unwrap()
67 } 67 }
68 68
69 pub fn syntax_node_ptr(self) -> SyntaxNodePtr { 69 pub fn syntax_node_ptr(self) -> SyntaxNodePtr {
70 self.ptr 70 self.raw
71 } 71 }
72} 72}
73 73