diff --git a/idl/idl_api.ysl2 b/idl/idl_api.ysl2 index 1eb62ab..179818a 100644 --- a/idl/idl_api.ysl2 +++ b/idl/idl_api.ysl2 @@ -100,12 +100,33 @@ def "func:idl_type_get_resolved_type" { def "func:idl_type_get_type_of_deftype" { param "idltype"; + const "deftype", "//deftype[@name=$idltype]"; + const "type_or_typekind", "$deftype/as/@type"; + choose { when "func:idl_type_is_of_typekind_deftype($idltype)" - result "//deftype[@name=$idltype]/as/@type"; + choose { + when "func:idl_typekind_is_generic($type_or_typekind)" + result call "type_of_generic_deftype" with "deftype", "$deftype"; + otherwise + result "$type_or_typekind"; + } otherwise error > idl_resolve_deftype - is not a deftype: «$idltype»; } } +function "type_of_generic_deftype" { + param "deftype"; + const "generic_type", "$deftype/as/@type"; + + > «$generic_type» + > < + for "$deftype/as/generic/*" { + const "param_type", "name()"; + > «$param_type»«func:autocomma()» + } + > > +} +