Skip to content

Commit 9b29716

Browse files
committed
Fix restore/persist storage
1 parent c246419 commit 9b29716

File tree

2 files changed

+1
-20
lines changed

2 files changed

+1
-20
lines changed

src/Analyser/Generator/ExprHandler/NewHandler.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ public function analyseExpr(
173173

174174
if ($constructorReflection !== null) {
175175
$storage = yield new PersistStorageRequest();
176-
yield new RestoreStorageRequest($storage);
177176
$parametersAcceptor = (yield new RunInFiberRequest(static fn () => ParametersAcceptorSelector::selectFromArgs(
178177
$scope,
179178
$expr->getArgs(),
@@ -231,7 +230,6 @@ private function processAnonymousClass(
231230
if ($classReflection->hasConstructor()) {
232231
$constructorReflection = $classReflection->getConstructor();
233232
$storage = yield new PersistStorageRequest();
234-
yield new RestoreStorageRequest($storage);
235233
$parametersAcceptor = (yield new RunInFiberRequest(static fn () => ParametersAcceptorSelector::selectFromArgs(
236234
$scope,
237235
$expr->getArgs(),
@@ -399,7 +397,6 @@ private function exactInstantiation(GeneratorScope $scope, New_ $node, Name $cla
399397
);
400398

401399
$storage = yield new PersistStorageRequest();
402-
yield new RestoreStorageRequest($storage);
403400
$parametersAcceptor = (yield new RunInFiberRequest(static fn () => ParametersAcceptorSelector::selectFromArgs(
404401
$scope,
405402
$methodCall->getArgs(),

src/Analyser/Generator/GeneratorNodeScopeResolver.php

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -252,14 +252,7 @@ private function runTrampoline(
252252
$gen->generator->current();
253253
continue;
254254
} elseif ($yielded instanceof PersistStorageRequest) {
255-
$stack[] = $gen;
256-
$gen = new IdentifiedGeneratorInStack(
257-
$this->persistStorage($exprAnalysisResultStorage),
258-
new Stmt\Expression(new Node\Scalar\String_('fake')),
259-
$yielded->originFile,
260-
$yielded->originLine,
261-
);
262-
$gen->generator->current();
255+
$gen->generator->send($exprAnalysisResultStorage->duplicate());
263256
continue;
264257
} elseif ($yielded instanceof RestoreStorageRequest) {
265258
$exprAnalysisResultStorage = $yielded->storage->duplicate();
@@ -377,15 +370,6 @@ private function analyseAttrGroups(Stmt $stmt, array $attrGroups, GeneratorScope
377370
yield from $handler->processAttributeGroups($stmt, $attrGroups, $scope, $alternativeNodeCallback);
378371
}
379372

380-
/**
381-
* @return Generator<int, GeneratorTValueType, GeneratorTSendType, ExprAnalysisResultStorage>
382-
*/
383-
private function persistStorage(ExprAnalysisResultStorage $storage): Generator
384-
{
385-
yield from [];
386-
return $storage;
387-
}
388-
389373
/**
390374
* @template T
391375
* @param callable(): T $callback

0 commit comments

Comments
 (0)