From f365db6b93fac5018dcff9b31c3cc9adca0fa335 Mon Sep 17 00:00:00 2001 From: heck Date: Fri, 16 Jun 2023 13:23:03 +0200 Subject: [PATCH] idl-api: add idl_type_is_generic() --- idl/idl_api.ysl2 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/idl/idl_api.ysl2 b/idl/idl_api.ysl2 index a93ecac..1eb62ab 100644 --- a/idl/idl_api.ysl2 +++ b/idl/idl_api.ysl2 @@ -60,11 +60,13 @@ def "func:idl_type_is_of_typekind_struct" { result "func:exists(//struct[@name=$idltype])"; } -def "func:idl_type_is_of_typekind_list" { +def "func:idl_type_is_generic§" { param "idltype"; - result "false()"; + result "contains($idltype,'<') and contains($idltype,'>')" } + +// TODO: generic is actually not a typekid, this should return the generic typekind like list/map/pair def "func:idl_type_get_typekind_of_type" { param "idltype"; choose { @@ -76,8 +78,8 @@ def "func:idl_type_get_typekind_of_type" { result > enum when "func:idl_type_is_of_typekind_struct($idltype)" result > struct - when "func:idl_type_is_of_typekind_list($idltype)" - result > list + when "func:idl_type_is_generic($idltype)" + result > generic otherwise result "false()";