function.add_parameter (new CCodeFormalParameter ("self", array_type.get_cname ()));
// total length over all dimensions
function.add_parameter (new CCodeFormalParameter ("length", "int"));
+ if (array_type.element_type is GenericType) {
+ // dup function array elements
+ string func_name = "%s_dup_func".printf (array_type.element_type.type_parameter.name.down ());
+ function.add_parameter (new CCodeFormalParameter (func_name, "GBoxedCopyFunc"));
+ }
// definition
}
bool is_in_generic_type (DataType type) {
- if (type.type_parameter.parent_symbol is TypeSymbol
+ if (current_symbol != null && type.type_parameter.parent_symbol is TypeSymbol
&& (current_method == null || current_method.binding == MemberBinding.INSTANCE)) {
return true;
} else {
}
ccall.add_argument (csizeexpr);
+
+ if (array_type.element_type is GenericType) {
+ var elem_dupexpr = get_dup_func_expression (array_type.element_type, node.source_reference);
+ if (elem_dupexpr == null) {
+ elem_dupexpr = new CCodeConstant ("NULL");
+ }
+ ccall.add_argument (elem_dupexpr);
+ }
}
var ccomma = new CCodeCommaExpression ();