Disallowing for now binding of any types for struct fields
Publish PHP Package / docker (push) Successful in 8s
Details
Publish PHP Package / docker (push) Successful in 8s
Details
This commit is contained in:
parent
24271e54f5
commit
02412f515d
|
@ -30,6 +30,8 @@ function codegen(
|
|||
array $options = array()
|
||||
)
|
||||
{
|
||||
validate_meta($meta);
|
||||
|
||||
$twig = get_twig();
|
||||
if($tpl_cache_dir)
|
||||
$twig->setCache($tpl_cache_dir);
|
||||
|
@ -76,6 +78,21 @@ function get_twig(array $inc_path = [])
|
|||
return $twig;
|
||||
}
|
||||
|
||||
function validate_meta(\mtgMetaInfo $meta)
|
||||
{
|
||||
foreach($meta->getUnits() as $u)
|
||||
{
|
||||
if($u->object instanceof \mtgMetaStruct)
|
||||
{
|
||||
//NOTE: disallowing for now bindings to 'any' types for structs
|
||||
foreach($u->object->getFields() as $fld)
|
||||
if($fld->getType() == "any" || $fld->getType() == "any[]")
|
||||
throw new Exception("Field '{$fld->getName()}' in struct '{$u->object->getName()}' has unsupported for binding type '{$fld->getType()}'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: call it always inside codegen?
|
||||
function prepare_meta(\mtgMetaInfo $orig)
|
||||
{
|
||||
//NOTE: making a deep clone
|
||||
|
@ -89,6 +106,7 @@ function prepare_meta(\mtgMetaInfo $orig)
|
|||
return $meta;
|
||||
}
|
||||
|
||||
|
||||
function _make_arr_proxies(array &$arr_proxies, \mtgMetaInfo $meta, ?\mtgType $type, array &$traversed)
|
||||
{
|
||||
if($type == null)
|
||||
|
|
Loading…
Reference in New Issue