Adding validation of type refs pointing to named functions
Publish PHP Package / docker (push) Successful in 7s Details

This commit is contained in:
Pavel Shevaev 2024-05-31 20:51:47 +03:00
parent c4b453b302
commit 3da2b92a59
1 changed files with 11 additions and 2 deletions

View File

@ -54,7 +54,9 @@ class mtgTypeRef implements mtgType
while(sizeof(self::$unresolved) > 0)
{
$ref = array_shift(self::$unresolved);
$ref->resolve();
$resolved = $ref->resolve();
if($resolved instanceof mtgMetaFunc && $resolved->getName())
throw new Exception("Invalid resolving of named function as type: " . $resolved->getName() . " at " . $ref->origin);
}
}
@ -303,6 +305,11 @@ class mtgMetaStruct extends mtgUserType
throw new Exception("{$this->origin} : Duplicate interface reference '{$imp->getName()}'");
$s->attach($imp);
}
foreach($this->funcs as $func)
{
$func->validate($meta);
}
}
function getParent()
@ -456,7 +463,8 @@ class mtgMetaFunc extends mtgMetaUnit implements mtgType
$this->name = $name;
}
function validate(mtgMetaInfo $meta) {}
function validate(mtgMetaInfo $meta)
{}
function getMetaId()
{
@ -894,6 +902,7 @@ class mtgMetaField
{
return $this->hasToken($name) ? $this->tokens[$name] : null;
}
}
class mtgMetaPacket extends mtgMetaStruct