[PATCH v3 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; } ` -- v3: widl: Add support for inherited runtime classes. 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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/widl/parser.y b/tools/widl/parser.y index 5567d94559e..9c07536eac1 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -1009,8 +1009,9 @@ 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); } +runtimeclass_def: attributes runtimeclass inherit '{' class_interfaces '}' semicolon_opt + { if ($3 && type_get_type($3) != TYPE_RUNTIMECLASS) error_loc("%s is not a runtimeclass\n", $3->name); + $$ = type_runtimeclass_define($2, $1, $5); } ; apicontract: tAPICONTRACT typename { $$ = type_apicontract_declare($2, current_namespace); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/2559
On Mon Apr 3 08:33:03 2023 +0000, Rémi Bernon wrote:
Yeah it was just a suggestion, I didn't check it. You should use `$3 && type_get_type($3) != TYPE_RUNTIMECLASS` instead of two ifs. Yeah, I realized that after pushing and was going to add a comment. Though, I'm curious why there's no error checking in the helper functions. Wouldn't it be better to check if the parameter is NULL there?
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/2559#note_28648
On Mon Apr 3 08:53:31 2023 +0000, Mohamad Al-Jaf wrote:
Yeah, I realized that after pushing and was going to add a comment. Though, I'm curious why there's no error checking in the helper functions. Wouldn't it be better to check if the parameter is NULL there? It was never needed, so you can then say that it's an error to call it with a `NULL` parameter. I think it makes sense to make the check here, as the base class is optional.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/2559#note_28652
On Mon Apr 3 09:03:03 2023 +0000, Rémi Bernon wrote:
It was never needed, so you can then say that it's an error to call it with a `NULL` parameter. I think it makes sense to make the check here, as the base class is optional. Ah, you're right, that makes sense.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/2559#note_28653
This merge request was approved by Rémi Bernon. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2559
participants (3)
-
Mohamad Al-Jaf -
Mohamad Al-Jaf (@maljaf) -
Rémi Bernon