@@ -17,6 +17,7 @@ use rustc_ast::{
17
17
self as ast, AnonConst , Arm , AttrStyle , AttrVec , BinOp , BinOpKind , BlockCheckMode , CaptureBy ,
18
18
ClosureBinder , DUMMY_NODE_ID , Expr , ExprField , ExprKind , FnDecl , FnRetTy , Label , MacCall ,
19
19
MetaItemLit , Movability , Param , RangeLimits , StmtKind , Ty , TyKind , UnOp , UnsafeBinderCastKind ,
20
+ YieldKind ,
20
21
} ;
21
22
use rustc_ast_pretty:: pprust;
22
23
use rustc_data_structures:: stack:: ensure_sufficient_stack;
@@ -1314,7 +1315,9 @@ impl<'a> Parser<'a> {
1314
1315
if self . eat_keyword ( exp ! ( Yield ) ) {
1315
1316
let yield_span = self . prev_token . span ;
1316
1317
self . psess . gated_spans . gate ( sym:: yield_expr, yield_span) ;
1317
- return Ok ( self . mk_expr ( yield_span, ExprKind :: Yield ( Some ( self_arg) ) ) ) ;
1318
+ return Ok (
1319
+ self . mk_expr ( yield_span, ExprKind :: Yield ( Some ( self_arg) , YieldKind :: Postfix ) )
1320
+ ) ;
1318
1321
}
1319
1322
1320
1323
let fn_span_lo = self . token . span ;
@@ -1891,7 +1894,7 @@ impl<'a> Parser<'a> {
1891
1894
/// Parse `"yield" expr?`.
1892
1895
fn parse_expr_yield ( & mut self ) -> PResult < ' a , P < Expr > > {
1893
1896
let lo = self . prev_token . span ;
1894
- let kind = ExprKind :: Yield ( self . parse_expr_opt ( ) ?) ;
1897
+ let kind = ExprKind :: Yield ( self . parse_expr_opt ( ) ?, YieldKind :: Prefix ) ;
1895
1898
let span = lo. to ( self . prev_token . span ) ;
1896
1899
self . psess . gated_spans . gate ( sym:: yield_expr, span) ;
1897
1900
let expr = self . mk_expr ( span, kind) ;
@@ -4045,7 +4048,7 @@ impl MutVisitor for CondChecker<'_> {
4045
4048
| ExprKind :: MacCall ( _)
4046
4049
| ExprKind :: Struct ( _)
4047
4050
| ExprKind :: Repeat ( _, _)
4048
- | ExprKind :: Yield ( _)
4051
+ | ExprKind :: Yield ( _, _ )
4049
4052
| ExprKind :: Yeet ( _)
4050
4053
| ExprKind :: Become ( _)
4051
4054
| ExprKind :: IncludedBytes ( _)
0 commit comments