array = (array_field == null || !array_field.no_array_length);
} else if (assignment.left.value_type is DelegateType) {
var delegate_type = (DelegateType) assignment.left.value_type;
- instance_delegate = delegate_type.delegate_symbol.has_target;
+ if (delegate_type.delegate_symbol.has_target) {
+ var delegate_field = assignment.left.symbol_reference as Field;
+ if (delegate_field == null || !delegate_field.no_delegate_target) {
+ instance_delegate = true;
+ }
+ }
}
if (unref_old || array || instance_delegate) {
var rhs_array_len = head.get_array_length_cexpression (init.initializer, dim);
ccomma.append_expression (new CCodeAssignment (lhs, rhs_array_len));
}
- } else if (f.field_type is DelegateType) {
+ } else if (f.field_type is DelegateType && !f.no_delegate_target) {
if (expr.type_reference.data_type is Struct) {
lhs = new CCodeMemberAccess (typed_inst, get_delegate_target_cname (f.get_cname ()));
} else {
*/
public bool no_array_length { get; set; }
+ /**
+ * Specifies whether a delegate target field should implicitly be created
+ * if the field type is a delegate.
+ */
+ public bool no_delegate_target { get; set; }
+
/**
* Specifies whether the array is null terminated.
*/
if (a.has_argument ("array_length_cexpr")) {
set_array_length_cexpr (a.get_string ("array_length_cexpr"));
}
+ if (a.has_argument ("delegate_target")) {
+ no_delegate_target = !a.get_bool ("delegate_target");
+ }
}
/**