@@ -2327,7 +2327,6 @@ static function () use ($expr, $rightResult): MutatingScope {
23272327 || $ expr instanceof Expr \Print_
23282328 || $ expr instanceof Expr \UnaryMinus
23292329 || $ expr instanceof Expr \UnaryPlus
2330- || $ expr instanceof Expr \YieldFrom
23312330 ) {
23322331 $ result = $ this ->processExprNode ($ expr ->expr , $ scope , $ nodeCallback , $ context ->enterDeep ());
23332332 $ throwPoints = $ result ->getThrowPoints ();
@@ -2337,6 +2336,17 @@ static function () use ($expr, $rightResult): MutatingScope {
23372336 $ hasYield = $ result ->hasYield ();
23382337 }
23392338
2339+ $ scope = $ result ->getScope ();
2340+ } elseif ($ expr instanceof Expr \YieldFrom) {
2341+ $ result = $ this ->processExprNode ($ expr ->expr , $ scope , $ nodeCallback , $ context ->enterDeep ());
2342+ $ throwPoints = $ result ->getThrowPoints ();
2343+ $ throwPoints [] = ThrowPoint::createImplicit ($ scope );
2344+ if ($ expr instanceof Expr \YieldFrom) {
2345+ $ hasYield = true ;
2346+ } else {
2347+ $ hasYield = $ result ->hasYield ();
2348+ }
2349+
23402350 $ scope = $ result ->getScope ();
23412351 } elseif ($ expr instanceof BooleanNot) {
23422352 $ result = $ this ->processExprNode ($ expr ->expr , $ scope , $ nodeCallback , $ context ->enterDeep ());
@@ -2518,7 +2528,9 @@ static function () use ($finalScope, $expr): MutatingScope {
25182528 );
25192529
25202530 } elseif ($ expr instanceof Expr \Yield_) {
2521- $ throwPoints = [];
2531+ $ throwPoints = [
2532+ ThrowPoint::createImplicit ($ scope ),
2533+ ];
25222534 if ($ expr ->key !== null ) {
25232535 $ keyResult = $ this ->processExprNode ($ expr ->key , $ scope , $ nodeCallback , $ context ->enterDeep ());
25242536 $ scope = $ keyResult ->getScope ();
0 commit comments