diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2022-08-07 15:21:11 +0200 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2022-08-10 18:34:54 +0200 |
| commit | 970184528718d7c10579cac7b7e7e66ef2e2a3f5 (patch) | |
| tree | a44dde46934f594c8eaf16bf66d4eb2d4a39efbd /compiler/rustc_parse/src/parser/expr.rs | |
| parent | 1603a70f82240ba2d27f72f964e36614d7620ad3 (diff) | |
| download | rust-970184528718d7c10579cac7b7e7e66ef2e2a3f5.tar.gz rust-970184528718d7c10579cac7b7e7e66ef2e2a3f5.zip | |
Do not consider method call receiver as an argument in AST.
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index b8bd960a5b3..54ad6843e75 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -850,7 +850,7 @@ impl<'a> Parser<'a> { ExprKind::Index(_, _) => "indexing", ExprKind::Try(_) => "`?`", ExprKind::Field(_, _) => "a field access", - ExprKind::MethodCall(_, _, _) => "a method call", + ExprKind::MethodCall(_, _, _, _) => "a method call", ExprKind::Call(_, _) => "a function call", ExprKind::Await(_) => "`.await`", ExprKind::Err => return Ok(with_postfix), @@ -1280,12 +1280,14 @@ impl<'a> Parser<'a> { if self.check(&token::OpenDelim(Delimiter::Parenthesis)) { // Method call `expr.f()` - let mut args = self.parse_paren_expr_seq()?; - args.insert(0, self_arg); - + let args = self.parse_paren_expr_seq()?; let fn_span = fn_span_lo.to(self.prev_token.span); let span = lo.to(self.prev_token.span); - Ok(self.mk_expr(span, ExprKind::MethodCall(segment, args, fn_span), AttrVec::new())) + Ok(self.mk_expr( + span, + ExprKind::MethodCall(segment, self_arg, args, fn_span), + AttrVec::new(), + )) } else { // Field access `expr.f` if let Some(args) = segment.args { |
