From: Rémi Bernon rbernon@codeweavers.com
And we can just pass them through, as with other class types. This fixes widl not accepting EventRegistrationToken method argument type in a parameterized type.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- tools/widl/typetree.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c index 800ddf77219..3ad140d520c 100644 --- a/tools/widl/typetree.c +++ b/tools/widl/typetree.c @@ -1157,6 +1157,9 @@ static type_t *replace_type_parameters_in_type(type_t *type, typeref_list_t *ori case TYPE_INTERFACE: case TYPE_RUNTIMECLASS: case TYPE_DELEGATE: + case TYPE_STRUCT: + case TYPE_ENCAPSULATED_UNION: + case TYPE_UNION: return type; case TYPE_PARAMETER: if (!orig || !repl) return NULL; @@ -1194,9 +1197,6 @@ static type_t *replace_type_parameters_in_type(type_t *type, typeref_list_t *ori if (t->type_type != TYPE_PARAMETERIZED_TYPE) return find_parameterized_type(type, repl); repl = replace_type_parameters_in_type_list(type->details.parameterized.params, orig, repl); return replace_type_parameters_in_type(t, t->details.parameterized.params, repl); - case TYPE_STRUCT: - case TYPE_ENCAPSULATED_UNION: - case TYPE_UNION: case TYPE_MODULE: case TYPE_COCLASS: case TYPE_APICONTRACT:
From: Rémi Bernon rbernon@codeweavers.com
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- tools/widl/parser.y | 6 +++--- tools/widl/typetree.c | 9 +++++---- tools/widl/typetree.h | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/tools/widl/parser.y b/tools/widl/parser.y index 02db99a55b7..4000f37032c 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -477,7 +477,7 @@ typedecl: | structdef | tSTRUCT aIDENTIFIER { $$ = type_new_struct($2, current_namespace, FALSE, NULL); } | uniondef - | tUNION aIDENTIFIER { $$ = type_new_nonencapsulated_union($2, FALSE, NULL); } + | tUNION aIDENTIFIER { $$ = type_new_nonencapsulated_union($2, current_namespace, FALSE, NULL); } | attributes enumdef { $$ = $2; $$->attrs = check_enum_attrs($1); } | attributes structdef { $$ = $2; $$->attrs = check_struct_attrs($1); } | attributes uniondef { $$ = $2; $$->attrs = check_union_attrs($1); } @@ -1277,7 +1277,7 @@ unqualified_type: | structdef { $$ = $1; } | tSTRUCT aIDENTIFIER { $$ = type_new_struct($2, current_namespace, FALSE, NULL); } | uniondef { $$ = $1; } - | tUNION aIDENTIFIER { $$ = type_new_nonencapsulated_union($2, FALSE, NULL); } + | tUNION aIDENTIFIER { $$ = type_new_nonencapsulated_union($2, current_namespace, FALSE, NULL); } | tSAFEARRAY '(' type ')' { $$ = make_safearray($3); } | aKNOWNTYPE { $$ = find_type_or_error(current_namespace, $1); } ; @@ -1296,7 +1296,7 @@ typedef: m_attributes tTYPEDEF m_attributes decl_spec declarator_list ;
uniondef: tUNION m_typename '{' ne_union_fields '}' - { $$ = type_new_nonencapsulated_union($2, TRUE, $4); } + { $$ = type_new_nonencapsulated_union($2, current_namespace, TRUE, $4); } | tUNION m_typename tSWITCH '(' s_field ')' m_ident '{' cases '}' { $$ = type_new_encapsulated_union($2, $5, $7, $9); } diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c index 3ad140d520c..fef9d2e5c03 100644 --- a/tools/widl/typetree.c +++ b/tools/widl/typetree.c @@ -580,19 +580,20 @@ type_t *type_new_struct(char *name, struct namespace *namespace, int defined, va return t; }
-type_t *type_new_nonencapsulated_union(const char *name, int defined, var_list_t *fields) +type_t *type_new_nonencapsulated_union(const char *name, struct namespace *namespace, int defined, var_list_t *fields) { type_t *t = NULL;
if (name) - t = find_type(name, NULL, tsUNION); + t = find_type(name, namespace, tsUNION);
if (!t) { t = make_type(TYPE_UNION); t->name = name; + t->namespace = namespace; if (name) - reg_type(t, name, NULL, tsUNION); + reg_type(t, name, namespace, tsUNION); }
if (!t->defined && defined) @@ -627,7 +628,7 @@ type_t *type_new_encapsulated_union(char *name, var_t *switch_field, var_t *unio { if (!union_field) union_field = make_var(xstrdup("tagged_union")); - union_field->declspec.type = type_new_nonencapsulated_union(gen_name(), TRUE, cases); + union_field->declspec.type = type_new_nonencapsulated_union(gen_name(), NULL, TRUE, cases);
t->details.structure = xmalloc(sizeof(*t->details.structure)); t->details.structure->fields = append_var(NULL, switch_field); diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h index 8f5e1ebdac5..be2288db021 100644 --- a/tools/widl/typetree.h +++ b/tools/widl/typetree.h @@ -53,7 +53,7 @@ type_t *type_new_void(void); type_t *type_coclass_declare(char *name); type_t *type_new_enum(const char *name, struct namespace *namespace, int defined, var_list_t *enums); type_t *type_new_struct(char *name, struct namespace *namespace, int defined, var_list_t *fields); -type_t *type_new_nonencapsulated_union(const char *name, int defined, var_list_t *fields); +type_t *type_new_nonencapsulated_union(const char *name, struct namespace *namespace, int defined, var_list_t *fields); type_t *type_new_encapsulated_union(char *name, var_t *switch_field, var_t *union_field, var_list_t *cases); type_t *type_new_bitfield(type_t *field_type, const expr_t *bits); type_t *type_runtimeclass_declare(char *name, struct namespace *namespace);