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; } `
-- v2: widl: Add support for inherited runtime classes.
From: Mohamad Al-Jaf mohamadaljaf@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..65fea494e0a 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) if (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); }
On Mon Apr 3 07:12:39 2023 +0000, Rémi Bernon wrote:
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.
Oh sorry, this was a mistake on my part.
On Mon Apr 3 08:19:01 2023 +0000, Mohamad Al-Jaf wrote:
changed this line in [version 2 of the diff](/wine/wine/-/merge_requests/2559/diffs?diff_id=40279&start_sha=89ba470d84231dbdbbe4c734cbe0c3c5e30c9314#492b92cda3894bf22ea547a8673a16139f4127e7_1018_1012)
The code you gave doesn't build, it results in a `Segmentation fault (core dumped)` error because the function `type_get_type` and subsequently the function it forwards to don't check if the parameter is NULL or not. I wasn't sure if modifying the helper function was the right way to go so I just added an if statement prior to checking the type.
On Mon Apr 3 08:23:29 2023 +0000, Mohamad Al-Jaf wrote:
The code you gave doesn't build, it results in a `Segmentation fault (core dumped)` error because the function `type_get_type` and subsequently the function it forwards to don't check if the parameter is NULL or not. I wasn't sure if modifying the helper function was the right way to go so I just added an if statement prior to checking the type.
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.