diff options
author | Ville Penttinen <[email protected]> | 2019-02-17 17:48:08 +0000 |
---|---|---|
committer | Ville Penttinen <[email protected]> | 2019-02-17 17:48:08 +0000 |
commit | 96e3ac389fbc3709cc6e7e8dbe25619daeb61f4b (patch) | |
tree | f92e14c1d9c09b8d1bc00d9135f43d3a6af4d7c1 /crates/ra_syntax/src | |
parent | 1c97c1ac11459d45f7bfc57dc72428d2b294520c (diff) |
Parse only outer_attributes for match arms for now
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r-- | crates/ra_syntax/src/grammar/attributes.rs | 10 | ||||
-rw-r--r-- | crates/ra_syntax/src/grammar/expressions/atom.rs | 7 |
2 files changed, 1 insertions, 16 deletions
diff --git a/crates/ra_syntax/src/grammar/attributes.rs b/crates/ra_syntax/src/grammar/attributes.rs index 2624d2e16..cd30e8a45 100644 --- a/crates/ra_syntax/src/grammar/attributes.rs +++ b/crates/ra_syntax/src/grammar/attributes.rs | |||
@@ -1,15 +1,5 @@ | |||
1 | use super::*; | 1 | use super::*; |
2 | 2 | ||
3 | /// Parses both inner & outer attributes. | ||
4 | /// | ||
5 | /// Allowing to run validation for reporting errors | ||
6 | /// regarding attributes | ||
7 | pub(super) fn all_attributes(p: &mut Parser) { | ||
8 | while p.at(POUND) { | ||
9 | attribute(p, p.nth(1) == EXCL) | ||
10 | } | ||
11 | } | ||
12 | |||
13 | pub(super) fn inner_attributes(p: &mut Parser) { | 3 | pub(super) fn inner_attributes(p: &mut Parser) { |
14 | while p.current() == POUND && p.nth(1) == EXCL { | 4 | while p.current() == POUND && p.nth(1) == EXCL { |
15 | attribute(p, true) | 5 | attribute(p, true) |
diff --git a/crates/ra_syntax/src/grammar/expressions/atom.rs b/crates/ra_syntax/src/grammar/expressions/atom.rs index 67cd7e6b0..e74305b6a 100644 --- a/crates/ra_syntax/src/grammar/expressions/atom.rs +++ b/crates/ra_syntax/src/grammar/expressions/atom.rs | |||
@@ -331,11 +331,6 @@ pub(crate) fn match_arm_list(p: &mut Parser) { | |||
331 | continue; | 331 | continue; |
332 | } | 332 | } |
333 | 333 | ||
334 | // This may result in invalid attributes | ||
335 | // if there are inner attributes mixed in together | ||
336 | // with the outer attributes, but we allow parsing | ||
337 | // those so we can run validation and report better errors | ||
338 | |||
339 | // test match_arms_outer_attributes | 334 | // test match_arms_outer_attributes |
340 | // fn foo() { | 335 | // fn foo() { |
341 | // match () { | 336 | // match () { |
@@ -349,7 +344,7 @@ pub(crate) fn match_arm_list(p: &mut Parser) { | |||
349 | // _ => (), | 344 | // _ => (), |
350 | // } | 345 | // } |
351 | // } | 346 | // } |
352 | attributes::all_attributes(p); | 347 | attributes::outer_attributes(p); |
353 | 348 | ||
354 | // test match_arms_commas | 349 | // test match_arms_commas |
355 | // fn foo() { | 350 | // fn foo() { |