A bit optimizing unresolved type refs check
This commit is contained in:
parent
a73126b3e0
commit
40fd5cc0a1
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue