Commit fd96c546 authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

widl: Simplify write_parameter_conf_or_var_exprs by making use of typegen_detect_type.

Remove the difficult manual walking of the alias tree and make the code easier to read and less likely to break if a new type is added.
parent 82ab9443
...@@ -3324,15 +3324,10 @@ static void write_parameter_conf_or_var_exprs(FILE *file, int indent, const char ...@@ -3324,15 +3324,10 @@ static void write_parameter_conf_or_var_exprs(FILE *file, int indent, const char
/* get fundamental type for the argument */ /* get fundamental type for the argument */
for (;;) for (;;)
{ {
if (is_attr(type->attrs, ATTR_WIREMARSHAL)) switch (typegen_detect_type(type, var->attrs, TDT_IGNORE_STRINGS|TDT_IGNORE_RANGES))
break;
else if (is_attr(type->attrs, ATTR_CONTEXTHANDLE))
break;
else if (type_is_alias(type))
type = type_alias_get_aliasee(type);
else if (is_array(type))
{ {
if (is_conformance_needed_for_phase(phase) && is_array(type)) case TGT_ARRAY:
if (is_conformance_needed_for_phase(phase))
{ {
if (type_array_has_conformance(type)) if (type_array_has_conformance(type))
{ {
...@@ -3349,18 +3344,16 @@ static void write_parameter_conf_or_var_exprs(FILE *file, int indent, const char ...@@ -3349,18 +3344,16 @@ static void write_parameter_conf_or_var_exprs(FILE *file, int indent, const char
} }
} }
break; break;
} case TGT_UNION:
else if (type_get_type(type) == TYPE_UNION) if (type_get_type(type) == TYPE_UNION &&
{ is_conformance_needed_for_phase(phase))
if (is_conformance_needed_for_phase(phase))
{ {
print_file(file, indent, "__frame->_StubMsg.MaxCount = (ULONG_PTR)"); print_file(file, indent, "__frame->_StubMsg.MaxCount = (ULONG_PTR)");
write_expr(file, get_attrp(var->attrs, ATTR_SWITCHIS), 1, 1, NULL, NULL, local_var_prefix); write_expr(file, get_attrp(var->attrs, ATTR_SWITCHIS), 1, 1, NULL, NULL, local_var_prefix);
fprintf(file, ";\n\n"); fprintf(file, ";\n\n");
} }
break; break;
} case TGT_IFACE_POINTER:
else if (type_get_type(type) == TYPE_INTERFACE || is_void(type))
{ {
expr_t *iid; expr_t *iid;
...@@ -3372,10 +3365,21 @@ static void write_parameter_conf_or_var_exprs(FILE *file, int indent, const char ...@@ -3372,10 +3365,21 @@ static void write_parameter_conf_or_var_exprs(FILE *file, int indent, const char
} }
break; break;
} }
else if (is_ptr(type)) case TGT_POINTER:
type = type_pointer_get_ref(type); type = type_pointer_get_ref(type);
else continue;
case TGT_INVALID:
case TGT_USER_TYPE:
case TGT_CTXT_HANDLE:
case TGT_CTXT_HANDLE_POINTER:
case TGT_STRING:
case TGT_BASIC:
case TGT_ENUM:
case TGT_STRUCT:
case TGT_RANGE:
break; break;
}
break;
} }
} }
......
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