@@ -1002,22 +1002,25 @@ impl<'a> Parser<'a> {
10021002 match self . token . uninterpolate ( ) . kind {
10031003 token:: Ident ( ..) => self . parse_dot_suffix ( base, lo) ,
10041004 token:: Literal ( token:: Lit { kind : token:: Integer , symbol, suffix } ) => {
1005+ let ident_span = self . token . span ;
10051006 self . bump ( ) ;
1006- Ok ( self . parse_expr_tuple_field_access ( lo, base, symbol, suffix) )
1007+ Ok ( self . mk_expr_tuple_field_access ( lo, ident_span , base, symbol, suffix) )
10071008 }
10081009 token:: Literal ( token:: Lit { kind : token:: Float , symbol, suffix } ) => {
10091010 Ok ( match self . break_up_float ( symbol, self . token . span ) {
10101011 // 1e2
10111012 DestructuredFloat :: Single ( sym, _sp) => {
1013+ let ident_span = self . token . span ;
10121014 self . bump ( ) ;
1013- self . parse_expr_tuple_field_access ( lo, base, sym, suffix)
1015+ self . mk_expr_tuple_field_access ( lo, ident_span , base, sym, suffix)
10141016 }
10151017 // 1.
10161018 DestructuredFloat :: TrailingDot ( sym, ident_span, dot_span) => {
10171019 assert ! ( suffix. is_none( ) ) ;
10181020 self . token = Token :: new ( token:: Ident ( sym, IdentIsRaw :: No ) , ident_span) ;
1021+ let ident_span = self . token . span ;
10191022 self . bump_with ( ( Token :: new ( token:: Dot , dot_span) , self . token_spacing ) ) ;
1020- self . parse_expr_tuple_field_access ( lo, base, sym, None )
1023+ self . mk_expr_tuple_field_access ( lo, ident_span , base, sym, None )
10211024 }
10221025 // 1.2 | 1.2e3
10231026 DestructuredFloat :: MiddleDot (
@@ -1030,13 +1033,16 @@ impl<'a> Parser<'a> {
10301033 self . token = Token :: new ( token:: Ident ( symbol1, IdentIsRaw :: No ) , ident1_span) ;
10311034 // This needs to be `Spacing::Alone` to prevent regressions.
10321035 // See issue #76399 and PR #76285 for more details
1036+ let ident_span = self . token . span ;
10331037 self . bump_with ( ( Token :: new ( token:: Dot , dot_span) , Spacing :: Alone ) ) ;
1034- let base1 = self . parse_expr_tuple_field_access ( lo, base, symbol1, None ) ;
1038+ let base1 =
1039+ self . mk_expr_tuple_field_access ( lo, ident_span, base, symbol1, None ) ;
10351040 let next_token2 =
10361041 Token :: new ( token:: Ident ( symbol2, IdentIsRaw :: No ) , ident2_span) ;
10371042 self . bump_with ( ( next_token2, self . token_spacing ) ) ; // `.`
1043+ let ident_span = self . token . span ;
10381044 self . bump ( ) ;
1039- self . parse_expr_tuple_field_access ( lo, base1, symbol2, suffix)
1045+ self . mk_expr_tuple_field_access ( lo, ident_span , base1, symbol2, suffix)
10401046 }
10411047 DestructuredFloat :: Error => base,
10421048 } )
@@ -1254,19 +1260,18 @@ impl<'a> Parser<'a> {
12541260 Ok ( fields. into_iter ( ) . collect ( ) )
12551261 }
12561262
1257- fn parse_expr_tuple_field_access (
1263+ fn mk_expr_tuple_field_access (
12581264 & mut self ,
12591265 lo : Span ,
1266+ ident_span : Span ,
12601267 base : P < Expr > ,
12611268 field : Symbol ,
12621269 suffix : Option < Symbol > ,
12631270 ) -> P < Expr > {
1264- let span = self . prev_token . span ;
1265- let field = ExprKind :: Field ( base, Ident :: new ( field, span) ) ;
12661271 if let Some ( suffix) = suffix {
1267- self . expect_no_tuple_index_suffix ( span , suffix) ;
1272+ self . expect_no_tuple_index_suffix ( ident_span , suffix) ;
12681273 }
1269- self . mk_expr ( lo. to ( span ) , field)
1274+ self . mk_expr ( lo. to ( ident_span ) , ExprKind :: Field ( base , Ident :: new ( field, ident_span ) ) )
12701275 }
12711276
12721277 /// Parse a function call expression, `expr(...)`.
0 commit comments