@@ -756,22 +756,22 @@ impl<'a> Parser<'a> {
756
756
break ;
757
757
}
758
758
match self . token . kind {
759
- // expr(...)
760
- token:: OpenDelim ( token:: Paren ) => {
761
- let seq = self . parse_paren_expr_seq ( ) . map ( |es| {
762
- let nd = self . mk_call ( e, es) ;
763
- let hi = self . prev_span ;
764
- self . mk_expr ( lo. to ( hi) , nd, AttrVec :: new ( ) )
765
- } ) ;
766
- e = self . recover_seq_parse_error ( token:: Paren , lo, seq) ;
767
- }
759
+ token:: OpenDelim ( token:: Paren ) => e = Ok ( self . parse_fn_call_expr ( lo, e) ) ,
768
760
token:: OpenDelim ( token:: Bracket ) => e = self . parse_index_expr ( lo, e) ?,
769
761
_ => return Ok ( e) ,
770
762
}
771
763
}
772
764
return Ok ( e) ;
773
765
}
774
766
767
+ /// Parse a function call expression, `expr(...)`.
768
+ fn parse_fn_call_expr ( & mut self , lo : Span , fun : P < Expr > ) -> P < Expr > {
769
+ let seq = self . parse_paren_expr_seq ( ) . map ( |args| {
770
+ self . mk_expr ( lo. to ( self . prev_span ) , self . mk_call ( fun, args) , AttrVec :: new ( ) )
771
+ } ) ;
772
+ self . recover_seq_parse_error ( token:: Paren , lo, seq)
773
+ }
774
+
775
775
/// Parse an indexing expression `expr[...]`.
776
776
fn parse_index_expr ( & mut self , lo : Span , base : P < Expr > ) -> PResult < ' a , P < Expr > > {
777
777
self . bump ( ) ; // `[`
0 commit comments