From 40fd5cc0a1207c88a9d7973e221666f110392d8d Mon Sep 17 00:00:00 2001 From: Pavel Shevaev Date: Thu, 3 Aug 2023 23:00:31 +0300 Subject: [PATCH] A bit optimizing unresolved type refs check --- metagen.inc.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/metagen.inc.php b/metagen.inc.php index d389220..cdff5fc 100644 --- a/metagen.inc.php +++ b/metagen.inc.php @@ -5,7 +5,7 @@ interface mtgType class mtgTypeRef implements mtgType { - private static $all = array(); + private static $unresolved = array(); private $name; private $file; @@ -26,19 +26,23 @@ class mtgTypeRef implements mtgType $this->name = $name_or_resolved; if(!$module) throw new Exception("Module is not set"); + + self::$unresolved[] = $this; } $this->module = $module; $this->file = $file; $this->line = $line; - self::$all[] = $this; } static function checkAllResolved() { - foreach(self::$all as $ref) + while(sizeof(self::$unresolved) > 0) + { + $ref = array_shift(self::$unresolved); $ref->resolve(); + } } function resolve()