@@ -692,30 +692,27 @@ impl<'a> Parser<'a> {
692
692
}
693
693
}
694
694
695
- fn parse_dot_or_call_expr_with_ ( & mut self , e0 : P < Expr > , lo : Span ) -> PResult < ' a , P < Expr > > {
696
- let mut e = e0;
695
+ fn parse_dot_or_call_expr_with_ ( & mut self , mut e : P < Expr > , lo : Span ) -> PResult < ' a , P < Expr > > {
697
696
loop {
698
- // expr?
699
- while self . eat ( & token :: Question ) {
700
- let hi = self . prev_span ;
701
- e = self . mk_expr ( lo . to ( hi ) , ExprKind :: Try ( e ) , AttrVec :: new ( ) ) ;
697
+ if self . eat ( & token :: Question ) {
698
+ // `expr?`
699
+ e = self . mk_expr ( lo . to ( self . prev_span ) , ExprKind :: Try ( e ) , AttrVec :: new ( ) ) ;
700
+ continue ;
702
701
}
703
-
704
- // expr.f
705
702
if self . eat ( & token:: Dot ) {
703
+ // expr.f
706
704
e = self . parse_dot_suffix_expr ( lo, e) ?;
707
705
continue ;
708
706
}
709
707
if self . expr_is_complete ( & e) {
710
- break ;
708
+ return Ok ( e ) ;
711
709
}
712
- match self . token . kind {
713
- token:: OpenDelim ( token:: Paren ) => e = self . parse_fn_call_expr ( lo, e) ,
714
- token:: OpenDelim ( token:: Bracket ) => e = self . parse_index_expr ( lo, e) ?,
710
+ e = match self . token . kind {
711
+ token:: OpenDelim ( token:: Paren ) => self . parse_fn_call_expr ( lo, e) ,
712
+ token:: OpenDelim ( token:: Bracket ) => self . parse_index_expr ( lo, e) ?,
715
713
_ => return Ok ( e) ,
716
714
}
717
715
}
718
- return Ok ( e) ;
719
716
}
720
717
721
718
fn parse_dot_suffix_expr ( & mut self , lo : Span , base : P < Expr > ) -> PResult < ' a , P < Expr > > {
0 commit comments