Browse Source

idl-api: add idl_type_get_type_of_deftype() add support for generic types

main
heck 2 years ago
parent
commit
ce8df90f12
  1. 23
      idl/idl_api.ysl2

23
idl/idl_api.ysl2

@ -100,12 +100,33 @@ def "func:idl_type_get_resolved_type" {
def "func:idl_type_get_type_of_deftype" { def "func:idl_type_get_type_of_deftype" {
param "idltype"; param "idltype";
const "deftype", "//deftype[@name=$idltype]";
const "type_or_typekind", "$deftype/as/@type";
choose { choose {
when "func:idl_type_is_of_typekind_deftype($idltype)" 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 otherwise
error > idl_resolve_deftype - is not a deftype: «$idltype»; 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()»
}
> >
}

Loading…
Cancel
Save