diff options
Diffstat (limited to 'src/Execution/Stack.php')
| -rw-r--r-- | src/Execution/Stack.php | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/Execution/Stack.php b/src/Execution/Stack.php index dfecfec..1e32388 100644 --- a/src/Execution/Stack.php +++ b/src/Execution/Stack.php @@ -21,11 +21,12 @@ final class Stack private ?Frame $currentFrame = null; /** - * @param list<int|float|Ref|Frame|Label> $entries + * @var list<int|float|Ref|Frame|Label> */ - public function __construct( - private array $entries, - ) { + private array $entries; + + public function __construct() + { } public function pushFrame(Frame $frame): void @@ -154,17 +155,10 @@ final class Stack public function popEntriesToCurrentFrame(): void { - while (!$this->isEmpty()) { - if ($this->pop() instanceof Frame) { - break; - } - } - array_pop($this->frames); - if (count($this->frames) === 0) { - $this->currentFrame = null; - } else { - $this->currentFrame = end($this->frames); + while (!$this->isEmpty() && !$this->top() instanceof Frame) { + $this->pop(); } + $this->popFrame(); } public function top(): int|float|Ref|Frame|Label|null |
