diff options
Diffstat (limited to 'crates/ra_parser')
-rw-r--r-- | crates/ra_parser/src/grammar/params.rs | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/crates/ra_parser/src/grammar/params.rs b/crates/ra_parser/src/grammar/params.rs index 834d80b52..0b09f1874 100644 --- a/crates/ra_parser/src/grammar/params.rs +++ b/crates/ra_parser/src/grammar/params.rs | |||
@@ -5,15 +5,12 @@ use super::*; | |||
5 | // fn b(x: i32) {} | 5 | // fn b(x: i32) {} |
6 | // fn c(x: i32, ) {} | 6 | // fn c(x: i32, ) {} |
7 | // fn d(x: i32, y: ()) {} | 7 | // fn d(x: i32, y: ()) {} |
8 | // fn g1(#[attr1] #[attr2] pat: Type) {} | ||
9 | // fn g2(#[attr1] x: u8) {} | ||
10 | pub(super) fn param_list(p: &mut Parser) { | 8 | pub(super) fn param_list(p: &mut Parser) { |
11 | list_(p, Flavor::Normal) | 9 | list_(p, Flavor::Normal) |
12 | } | 10 | } |
13 | 11 | ||
14 | // test param_list_opt_patterns | 12 | // test param_list_opt_patterns |
15 | // fn foo<F: FnMut(&mut Foo<'a>)>(){} | 13 | // fn foo<F: FnMut(&mut Foo<'a>)>(){} |
16 | // fn foo<F: FnMut(#[attr] &mut Foo<'a>)>(){} | ||
17 | pub(super) fn param_list_opt_patterns(p: &mut Parser) { | 14 | pub(super) fn param_list_opt_patterns(p: &mut Parser) { |
18 | list_(p, Flavor::OptionalPattern) | 15 | list_(p, Flavor::OptionalPattern) |
19 | } | 16 | } |
@@ -44,10 +41,14 @@ fn list_(p: &mut Parser, flavor: Flavor) { | |||
44 | let m = p.start(); | 41 | let m = p.start(); |
45 | p.bump(); | 42 | p.bump(); |
46 | if flavor.type_required() { | 43 | if flavor.type_required() { |
44 | // test self_param_outer_attr | ||
45 | // fn f(#[must_use] self) {} | ||
47 | attributes::outer_attributes(p); | 46 | attributes::outer_attributes(p); |
48 | opt_self_param(p); | 47 | opt_self_param(p); |
49 | } | 48 | } |
50 | while !p.at(EOF) && !p.at(ket) { | 49 | while !p.at(EOF) && !p.at(ket) { |
50 | // test param_outer_arg | ||
51 | // fn f(#[attr1] pat: Type) {} | ||
51 | attributes::outer_attributes(p); | 52 | attributes::outer_attributes(p); |
52 | 53 | ||
53 | if flavor.type_required() && p.at(T![...]) { | 54 | if flavor.type_required() && p.at(T![...]) { |
@@ -65,7 +66,6 @@ fn list_(p: &mut Parser, flavor: Flavor) { | |||
65 | } | 66 | } |
66 | // test param_list_vararg | 67 | // test param_list_vararg |
67 | // extern "C" { fn printf(format: *const i8, ...) -> i32; } | 68 | // extern "C" { fn printf(format: *const i8, ...) -> i32; } |
68 | // extern "C" { fn printf(format: *const i8, #[attr] ...) -> i32; } | ||
69 | if flavor.type_required() { | 69 | if flavor.type_required() { |
70 | p.eat(T![...]); | 70 | p.eat(T![...]); |
71 | } | 71 | } |
@@ -95,7 +95,6 @@ fn value_parameter(p: &mut Parser, flavor: Flavor) { | |||
95 | // test trait_fn_placeholder_parameter | 95 | // test trait_fn_placeholder_parameter |
96 | // trait Foo { | 96 | // trait Foo { |
97 | // fn bar(_: u64, mut x: i32); | 97 | // fn bar(_: u64, mut x: i32); |
98 | // fn bar(#[attr] _: u64, #[attr] mut x: i32); | ||
99 | // } | 98 | // } |
100 | if (la0 == IDENT || la0 == T![_]) && la1 == T![:] | 99 | if (la0 == IDENT || la0 == T![_]) && la1 == T![:] |
101 | || la0 == T![mut] && la1 == IDENT && la2 == T![:] | 100 | || la0 == T![mut] && la1 == IDENT && la2 == T![:] |
@@ -119,12 +118,6 @@ fn value_parameter(p: &mut Parser, flavor: Flavor) { | |||
119 | // fn c(&'a self,) {} | 118 | // fn c(&'a self,) {} |
120 | // fn d(&'a mut self, x: i32) {} | 119 | // fn d(&'a mut self, x: i32) {} |
121 | // fn e(mut self) {} | 120 | // fn e(mut self) {} |
122 | // fn f(#[must_use] self) {} | ||
123 | // fn g1(#[attr] self) {} | ||
124 | // fn g2(#[attr] &self) {} | ||
125 | // fn g3<'a>(#[attr] &mut self) {} | ||
126 | // fn g4<'a>(#[attr] &'a self) {} | ||
127 | // fn g5<'a>(#[attr] &'a mut self) {} | ||
128 | // } | 121 | // } |
129 | fn opt_self_param(p: &mut Parser) { | 122 | fn opt_self_param(p: &mut Parser) { |
130 | let m; | 123 | let m; |
@@ -136,8 +129,6 @@ fn opt_self_param(p: &mut Parser) { | |||
136 | // impl S { | 129 | // impl S { |
137 | // fn a(self: &Self) {} | 130 | // fn a(self: &Self) {} |
138 | // fn b(mut self: Box<Self>) {} | 131 | // fn b(mut self: Box<Self>) {} |
139 | // fn c(#[attr] self: Self) {} | ||
140 | // fn d(#[attr] self: Rc<Self>) {} | ||
141 | // } | 132 | // } |
142 | if p.at(T![:]) { | 133 | if p.at(T![:]) { |
143 | types::ascription(p); | 134 | types::ascription(p); |