From b437e8bf3d4bc8d7957f060709ea8636bd38da8f Mon Sep 17 00:00:00 2001 From: heck Date: Fri, 16 Jun 2023 13:25:36 +0200 Subject: [PATCH] ig-c99: add ig_c99_typeclass() - typeclass resolution of type as defined in lms-c99 spec. --- lm-c99/ig-c99.ysl2 | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/lm-c99/ig-c99.ysl2 b/lm-c99/ig-c99.ysl2 index 323a56c..6808ff5 100644 --- a/lm-c99/ig-c99.ysl2 +++ b/lm-c99/ig-c99.ysl2 @@ -17,19 +17,29 @@ tstylesheet { // * object def "func:ig_c99_typeclass" { param "idltype"; + const "resolved_type", "func:idl_type_get_resolved_type($idltype)"; + const "resolved_typekind", "func:idl_type_get_typekind_of_type($resolved_type)"; choose { when "func:idl_type_is_defined($idltype)" choose { - when "func:idl_type_is_of_typekind_basetype($idltype)" + when "$resolved_typekind = 'basetype'" + choose { + when "$resolved_type = 'string'" + result > object + when "$resolved_type = 'binary'" + result > object + otherwise + result > primitive + } + when "$resolved_typekind = 'enum'" result > primitive - when "func:idl_type_is_of_typekind_deftype($idltype)" - result > primitive - when "func:idl_type_is_of_typekind_enum($idltype)" - result > primitive - when "func:idl_type_is_of_typekind_struct($idltype)" - result > primitive - + when "$resolved_typekind = 'struct'" + result > object + when "$resolved_typekind = 'generic'" + result > object + otherwise + error > ig_c99_typeclass - cant determine typeclass of: «$idltype» } otherwise error > ig_c99_typeclass - is not a type: «$idltype»