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; } `
From: Mohamad Al-Jaf mohamadaljaf@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); }
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.
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); }
```suggestion:-1+0 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.