Commit 837297c2 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

widl: Support namespaces for union declarations.

parent 25e1fb45
...@@ -477,7 +477,7 @@ typedecl: ...@@ -477,7 +477,7 @@ typedecl:
| structdef | structdef
| tSTRUCT aIDENTIFIER { $$ = type_new_struct($2, current_namespace, FALSE, NULL); } | tSTRUCT aIDENTIFIER { $$ = type_new_struct($2, current_namespace, FALSE, NULL); }
| uniondef | 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 enumdef { $$ = $2; $$->attrs = check_enum_attrs($1); }
| attributes structdef { $$ = $2; $$->attrs = check_struct_attrs($1); } | attributes structdef { $$ = $2; $$->attrs = check_struct_attrs($1); }
| attributes uniondef { $$ = $2; $$->attrs = check_union_attrs($1); } | attributes uniondef { $$ = $2; $$->attrs = check_union_attrs($1); }
...@@ -1277,7 +1277,7 @@ unqualified_type: ...@@ -1277,7 +1277,7 @@ unqualified_type:
| structdef { $$ = $1; } | structdef { $$ = $1; }
| tSTRUCT aIDENTIFIER { $$ = type_new_struct($2, current_namespace, FALSE, NULL); } | tSTRUCT aIDENTIFIER { $$ = type_new_struct($2, current_namespace, FALSE, NULL); }
| uniondef { $$ = $1; } | 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); } | tSAFEARRAY '(' type ')' { $$ = make_safearray($3); }
| aKNOWNTYPE { $$ = find_type_or_error(current_namespace, $1); } | aKNOWNTYPE { $$ = find_type_or_error(current_namespace, $1); }
; ;
...@@ -1296,7 +1296,7 @@ typedef: m_attributes tTYPEDEF m_attributes decl_spec declarator_list ...@@ -1296,7 +1296,7 @@ typedef: m_attributes tTYPEDEF m_attributes decl_spec declarator_list
; ;
uniondef: tUNION m_typename '{' ne_union_fields '}' 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 | tUNION m_typename
tSWITCH '(' s_field ')' tSWITCH '(' s_field ')'
m_ident '{' cases '}' { $$ = type_new_encapsulated_union($2, $5, $7, $9); } m_ident '{' cases '}' { $$ = type_new_encapsulated_union($2, $5, $7, $9); }
......
...@@ -580,19 +580,20 @@ type_t *type_new_struct(char *name, struct namespace *namespace, int defined, va ...@@ -580,19 +580,20 @@ type_t *type_new_struct(char *name, struct namespace *namespace, int defined, va
return t; 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; type_t *t = NULL;
if (name) if (name)
t = find_type(name, NULL, tsUNION); t = find_type(name, namespace, tsUNION);
if (!t) if (!t)
{ {
t = make_type(TYPE_UNION); t = make_type(TYPE_UNION);
t->name = name; t->name = name;
t->namespace = namespace;
if (name) if (name)
reg_type(t, name, NULL, tsUNION); reg_type(t, name, namespace, tsUNION);
} }
if (!t->defined && defined) if (!t->defined && defined)
...@@ -627,7 +628,7 @@ type_t *type_new_encapsulated_union(char *name, var_t *switch_field, var_t *unio ...@@ -627,7 +628,7 @@ type_t *type_new_encapsulated_union(char *name, var_t *switch_field, var_t *unio
{ {
if (!union_field) if (!union_field)
union_field = make_var(xstrdup("tagged_union")); 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 = xmalloc(sizeof(*t->details.structure));
t->details.structure->fields = append_var(NULL, switch_field); t->details.structure->fields = append_var(NULL, switch_field);
......
...@@ -53,7 +53,7 @@ type_t *type_new_void(void); ...@@ -53,7 +53,7 @@ type_t *type_new_void(void);
type_t *type_coclass_declare(char *name); 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_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_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_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_new_bitfield(type_t *field_type, const expr_t *bits);
type_t *type_runtimeclass_declare(char *name, struct namespace *namespace); type_t *type_runtimeclass_declare(char *name, struct namespace *namespace);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment