@@ -17,6 +17,7 @@ use rustc_ast::{
1717 self as ast, AnonConst , Arm , AttrStyle , AttrVec , BinOp , BinOpKind , BlockCheckMode , CaptureBy ,
1818 ClosureBinder , DUMMY_NODE_ID , Expr , ExprField , ExprKind , FnDecl , FnRetTy , Label , MacCall ,
1919 MetaItemLit , Movability , Param , RangeLimits , StmtKind , Ty , TyKind , UnOp , UnsafeBinderCastKind ,
20+ YieldKind ,
2021} ;
2122use rustc_ast_pretty:: pprust;
2223use rustc_data_structures:: stack:: ensure_sufficient_stack;
@@ -1314,7 +1315,9 @@ impl<'a> Parser<'a> {
13141315 if self . eat_keyword ( exp ! ( Yield ) ) {
13151316 let yield_span = self . prev_token . span ;
13161317 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+ ) ;
13181321 }
13191322
13201323 let fn_span_lo = self . token . span ;
@@ -1891,7 +1894,7 @@ impl<'a> Parser<'a> {
18911894 /// Parse `"yield" expr?`.
18921895 fn parse_expr_yield ( & mut self ) -> PResult < ' a , P < Expr > > {
18931896 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 ) ;
18951898 let span = lo. to ( self . prev_token . span ) ;
18961899 self . psess . gated_spans . gate ( sym:: yield_expr, span) ;
18971900 let expr = self . mk_expr ( span, kind) ;
@@ -4045,7 +4048,7 @@ impl MutVisitor for CondChecker<'_> {
40454048 | ExprKind :: MacCall ( _)
40464049 | ExprKind :: Struct ( _)
40474050 | ExprKind :: Repeat ( _, _)
4048- | ExprKind :: Yield ( _)
4051+ | ExprKind :: Yield ( _, _ )
40494052 | ExprKind :: Yeet ( _)
40504053 | ExprKind :: Become ( _)
40514054 | ExprKind :: IncludedBytes ( _)
0 commit comments