diff --git a/metagen.inc.php b/metagen.inc.php index 7e1a48e..0c57110 100644 --- a/metagen.inc.php +++ b/metagen.inc.php @@ -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