diff options
| author | Noah Lev <camelidcamel@gmail.com> | 2022-02-17 12:28:07 -0800 |
|---|---|---|
| committer | Noah Lev <camelidcamel@gmail.com> | 2022-03-23 22:31:57 -0700 |
| commit | 67a9adbb541f7c62e993d05ff3687a8695d5d349 (patch) | |
| tree | 3a957fdbde1fdef634d6ea682feaf686f0015616 /compiler/rustc_parse/src/parser/expr.rs | |
| parent | 80e57e223e98f7075cc4af83fa0eef948493d0df (diff) | |
| download | rust-67a9adbb541f7c62e993d05ff3687a8695d5d349.tar.gz rust-67a9adbb541f7c62e993d05ff3687a8695d5d349.zip | |
Refactor, handle fields better, add field tests
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 39d96b8a9e3..34ccd167e4e 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -592,13 +592,7 @@ impl<'a> Parser<'a> { this.bump(); this.parse_prefix_expr(None) } // `+expr` - token::Ident(..) if this.token.is_keyword(kw::Box) => { - make_it!(this, attrs, |this, _| this.parse_box_expr(lo)) - } - token::Ident(..) if this.is_mistaken_not_ident_negation() => { - make_it!(this, attrs, |this, _| this.recover_not_expr(lo)) - } - // Recover from `++x` + // Recover from `++x`: token::BinOp(token::Plus) if this.look_ahead(1, |t| *t == token::BinOp(token::Plus)) => { @@ -608,9 +602,15 @@ impl<'a> Parser<'a> { this.bump(); this.bump(); - let operand_expr = this.parse_path_start_expr(Default::default())?; + let operand_expr = this.parse_dot_or_call_expr(Default::default())?; this.maybe_recover_from_prefix_increment(operand_expr, pre_span, prev_is_semi) } + token::Ident(..) if this.token.is_keyword(kw::Box) => { + make_it!(this, attrs, |this, _| this.parse_box_expr(lo)) + } + token::Ident(..) if this.is_mistaken_not_ident_negation() => { + make_it!(this, attrs, |this, _| this.recover_not_expr(lo)) + } _ => return this.parse_dot_or_call_expr(Some(attrs)), } } |
