diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-06-30 11:05:51 +0100 |
---|---|---|
committer | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-06-30 11:05:51 +0100 |
commit | e18389d2684a8da9937fe37f9598fabf67c65fee (patch) | |
tree | 57b5338eb38b1f6cd0a254a7f3aa793bb44d815e /crates/ra_parser/src/grammar/expressions/atom.rs | |
parent | fb2534f30089ddd796dbf52c7bb639efe5d10a3e (diff) | |
parent | 2959aa446e452d2176f9db453e52047453a3904e (diff) |
Merge #1461
1461: Support attributes on array members r=matklad a=etaoins
Array members are allowed to have attributes such as `#[cfg]`.
Co-authored-by: Ryan Cumming <[email protected]>
Diffstat (limited to 'crates/ra_parser/src/grammar/expressions/atom.rs')
-rw-r--r-- | crates/ra_parser/src/grammar/expressions/atom.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/crates/ra_parser/src/grammar/expressions/atom.rs b/crates/ra_parser/src/grammar/expressions/atom.rs index 41be283d0..6bda04141 100644 --- a/crates/ra_parser/src/grammar/expressions/atom.rs +++ b/crates/ra_parser/src/grammar/expressions/atom.rs | |||
@@ -170,6 +170,15 @@ fn array_expr(p: &mut Parser) -> CompletedMarker { | |||
170 | if p.eat(T![']']) { | 170 | if p.eat(T![']']) { |
171 | return m.complete(p, ARRAY_EXPR); | 171 | return m.complete(p, ARRAY_EXPR); |
172 | } | 172 | } |
173 | |||
174 | // test first_array_member_attributes | ||
175 | // pub const A: &[i64] = &[ | ||
176 | // #[cfg(test)] | ||
177 | // 1, | ||
178 | // 2, | ||
179 | // ]; | ||
180 | attributes::outer_attributes(p); | ||
181 | |||
173 | expr(p); | 182 | expr(p); |
174 | if p.eat(T![;]) { | 183 | if p.eat(T![;]) { |
175 | expr(p); | 184 | expr(p); |
@@ -181,6 +190,14 @@ fn array_expr(p: &mut Parser) -> CompletedMarker { | |||
181 | if p.at(T![']']) { | 190 | if p.at(T![']']) { |
182 | break; | 191 | break; |
183 | } | 192 | } |
193 | |||
194 | // test subsequent_array_member_attributes | ||
195 | // pub const A: &[i64] = &[ | ||
196 | // 1, | ||
197 | // #[cfg(test)] | ||
198 | // 2, | ||
199 | // ]; | ||
200 | attributes::outer_attributes(p); | ||
184 | if !p.at_ts(EXPR_FIRST) { | 201 | if !p.at_ts(EXPR_FIRST) { |
185 | p.error("expected expression"); | 202 | p.error("expected expression"); |
186 | break; | 203 | break; |