widl: Add function for getting the interfaces defined by a coclass type.
Split out the defining of coclass types in the parser into a function.
This commit is contained in:
parent
1f519e17cc
commit
83b1f08117
|
@ -830,10 +830,7 @@ coclasshdr: attributes coclass { $$ = $2;
|
|||
;
|
||||
|
||||
coclassdef: coclasshdr '{' coclass_ints '}' semicolon_opt
|
||||
{ $$ = $1;
|
||||
$$->ifaces = $3;
|
||||
$$->defined = TRUE;
|
||||
}
|
||||
{ $$ = type_coclass_define($1, $3); }
|
||||
;
|
||||
|
||||
coclass_ints: { $$ = NULL; }
|
||||
|
|
|
@ -137,3 +137,10 @@ void type_module_define(type_t *module, statement_list_t *stmts)
|
|||
module->details.module->stmts = stmts;
|
||||
module->defined = TRUE;
|
||||
}
|
||||
|
||||
type_t *type_coclass_define(type_t *coclass, ifref_list_t *ifaces)
|
||||
{
|
||||
coclass->ifaces = ifaces;
|
||||
coclass->defined = TRUE;
|
||||
return coclass;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stm
|
|||
void type_dispinterface_define(type_t *iface, var_list_t *props, func_list_t *methods);
|
||||
void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface);
|
||||
void type_module_define(type_t *module, statement_list_t *stmts);
|
||||
type_t *type_coclass_define(type_t *coclass, ifref_list_t *ifaces);
|
||||
|
||||
/* FIXME: shouldn't need to export this */
|
||||
type_t *duptype(type_t *t, int dupname);
|
||||
|
@ -153,4 +154,10 @@ static inline int type_is_alias(const type_t *type)
|
|||
return type->is_alias;
|
||||
}
|
||||
|
||||
static inline ifref_list_t *type_coclass_get_ifaces(const type_t *type)
|
||||
{
|
||||
assert(type->type == RPC_FC_COCLASS);
|
||||
return type->ifaces;
|
||||
}
|
||||
|
||||
#endif /* WIDL_TYPE_TREE_H */
|
||||
|
|
|
@ -2099,6 +2099,7 @@ static void add_coclass_typeinfo(msft_typelib_t *typelib, type_t *cls)
|
|||
MSFT_RefRecord *ref, *first = NULL, *first_source = NULL;
|
||||
int have_default = 0, have_default_source = 0;
|
||||
const attr_t *attr;
|
||||
ifref_list_t *ifaces;
|
||||
|
||||
if (-1 < cls->typelib_idx)
|
||||
return;
|
||||
|
@ -2106,13 +2107,14 @@ static void add_coclass_typeinfo(msft_typelib_t *typelib, type_t *cls)
|
|||
cls->typelib_idx = typelib->typelib_header.nrtypeinfos;
|
||||
msft_typeinfo = create_msft_typeinfo(typelib, TKIND_COCLASS, cls->name, cls->attrs);
|
||||
|
||||
if (cls->ifaces) LIST_FOR_EACH_ENTRY( iref, cls->ifaces, ifref_t, entry ) num_ifaces++;
|
||||
ifaces = type_coclass_get_ifaces(cls);
|
||||
if (ifaces) LIST_FOR_EACH_ENTRY( iref, ifaces, ifref_t, entry ) num_ifaces++;
|
||||
|
||||
offset = msft_typeinfo->typeinfo->datatype1 = ctl2_alloc_segment(typelib, MSFT_SEG_REFERENCES,
|
||||
num_ifaces * sizeof(*ref), 0);
|
||||
|
||||
i = 0;
|
||||
if (cls->ifaces) LIST_FOR_EACH_ENTRY( iref, cls->ifaces, ifref_t, entry ) {
|
||||
if (ifaces) LIST_FOR_EACH_ENTRY( iref, ifaces, ifref_t, entry ) {
|
||||
if(iref->iface->typelib_idx == -1)
|
||||
add_interface_typeinfo(typelib, iref->iface);
|
||||
ref = (MSFT_RefRecord*) (typelib->typelib_segment_data[MSFT_SEG_REFERENCES] + offset + i * sizeof(*ref));
|
||||
|
|
Loading…
Reference in New Issue