A bit optimizing unresolved type refs check

This commit is contained in:
Pavel Shevaev 2023-08-03 23:00:31 +03:00
parent a73126b3e0
commit 40fd5cc0a1
1 changed files with 7 additions and 3 deletions

View File

@ -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()