[PATCH 0/1] MR2559: widl: Add support for inherited runtime classes.
Needed to build windows.ui.composition.idl. Example code that needs this: ` [ contract(Windows.Foundation.UniversalApiContract, 2.0), marshaling_behavior(agile), threading(both) ] runtimeclass ColorKeyFrameAnimation : Windows.UI.Composition.KeyFrameAnimation { [default] interface Windows.UI.Composition.IColorKeyFrameAnimation; } ` -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2559
From: Mohamad Al-Jaf <mohamadaljaf(a)gmail.com> Needed to build windows.ui.composition.idl. --- tools/widl/parser.y | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/widl/parser.y b/tools/widl/parser.y index 5567d94559e..79610b69353 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -326,7 +326,7 @@ void pop_import( PARSER_LTYPE *yylloc ); %type <declarator> m_abstract_declarator abstract_declarator abstract_declarator_no_direct abstract_direct_declarator %type <declarator_list> declarator_list struct_declarator_list %type <type> coclass coclassdef -%type <type> runtimeclass runtimeclass_def +%type <type> base runtimeclass runtimeclass_def %type <type> apicontract apicontract_def %type <num> contract_ver %type <num> pointer_type threading_type marshaling_behavior version @@ -1009,8 +1009,13 @@ coclassdef: attributes coclass '{' class_interfaces '}' semicolon_opt runtimeclass: tRUNTIMECLASS typename { $$ = type_runtimeclass_declare($2, current_namespace); } ; -runtimeclass_def: attributes runtimeclass '{' class_interfaces '}' semicolon_opt - { $$ = type_runtimeclass_define($2, $1, $4); } +base + : %empty { $$ = NULL; } + | tRUNTIMECLASS runtimeclass { $$ = $2; } + ; + +runtimeclass_def: attributes runtimeclass inherit base '{' class_interfaces '}' semicolon_opt + { $$ = type_runtimeclass_define($2, $1, $6); } ; apicontract: tAPICONTRACT typename { $$ = type_apicontract_declare($2, current_namespace); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/2559
Rémi Bernon (@rbernon) commented about tools/widl/parser.y:
runtimeclass: tRUNTIMECLASS typename { $$ = type_runtimeclass_declare($2, current_namespace); } ;
-runtimeclass_def: attributes runtimeclass '{' class_interfaces '}' semicolon_opt - { $$ = type_runtimeclass_define($2, $1, $4); } +base + : %empty { $$ = NULL; } + | tRUNTIMECLASS runtimeclass { $$ = $2; } + ; + +runtimeclass_def: attributes runtimeclass inherit base '{' class_interfaces '}' semicolon_opt + { $$ = type_runtimeclass_define($2, $1, $6); } ; I don't see the `runtimeclass A : runtimeclass B` pattern anywhere in the SDK. Should it really be supported?
If not you only need to add `inherit` there. If it is, I'd suggest to duplicate the `inherit` rule and name it `class_inherit` instead of `base`, to be more explicit. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2559#note_28623
Rémi Bernon (@rbernon) commented about tools/widl/parser.y:
runtimeclass: tRUNTIMECLASS typename { $$ = type_runtimeclass_declare($2, current_namespace); } ;
-runtimeclass_def: attributes runtimeclass '{' class_interfaces '}' semicolon_opt - { $$ = type_runtimeclass_define($2, $1, $4); } +base + : %empty { $$ = NULL; } + | tRUNTIMECLASS runtimeclass { $$ = $2; } + ; + +runtimeclass_def: attributes runtimeclass inherit base '{' class_interfaces '}' semicolon_opt + { $$ = type_runtimeclass_define($2, $1, $6); }
runtimeclass_def: attributes runtimeclass inherit '{' class_interfaces '}' semicolon_opt
{ if (type_get_type($3) != TYPE_RUNTIMECLASS) error_loc("%s is not a runtimeclass\n", $3->name);
$$ = type_runtimeclass_define($2, $1, $5); }
Assuming base isn't needed. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2559#note_28624
participants (3)
-
Mohamad Al-Jaf -
Mohamad Al-Jaf (@maljaf) -
Rémi Bernon