}
}
+ public bool finish_instance {
+ get {
+ if (_finish_instance == null) {
+ Method m = node as Method;
+ bool is_creation_method = m is CreationMethod;
+ if (ccode == null || m == null || m.is_abstract || m.is_virtual) {
+ _finish_instance = !is_creation_method;
+ } else {
+ _finish_instance = ccode.get_bool ("finish_instance", !is_creation_method);
+ }
+ }
+ return _finish_instance;
+ }
+ }
+
public string delegate_target_name {
get {
if (_delegate_target_name == null) {
private string _finish_name;
private string _finish_vfunc_name;
private string _finish_real_name;
+ private bool? _finish_instance;
private string _real_name;
private string _delegate_target_name;
private string _ctype;
}
}
+ if (m != null && m.parent_symbol is Class) {
+ if (get_ccode_finish_instance (m)) {
+ var tmp = new CCodeMemberAccess.pointer (new CCodeIdentifier ("_data_"), "_source_object_");
+ out_arg_map.set (get_param_pos (get_ccode_instance_pos (m)), tmp);
+ }
+ }
+
// append C arguments in the right order
int last_pos;
return get_ccode_free_function (sym) == "g_boxed_free";
}
+ public static bool get_ccode_finish_instance (CodeNode node) {
+ return get_ccode_attribute (node).finish_instance;
+ }
+
public static string get_ccode_type_id (CodeNode node) {
return get_ccode_attribute(node).type_id;
}
instance = new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, get_cvalue_ (instance_value));
}
- in_arg_map.set (get_param_pos (get_ccode_instance_pos (m)), instance);
- out_arg_map.set (get_param_pos (get_ccode_instance_pos (m)), instance);
+ if (expr.is_yield_expression) {
+ in_arg_map.set (get_param_pos (get_ccode_instance_pos (m)), instance);
+ if (get_ccode_finish_instance (m)) {
+ out_arg_map.set (get_param_pos (get_ccode_instance_pos (m)), instance);
+ }
+ } else if (ma.member_name != "end" || get_ccode_finish_instance (m)) {
+ out_arg_map.set (get_param_pos (get_ccode_instance_pos (m)), instance);
+ in_arg_map.set (get_param_pos (get_ccode_instance_pos (m)), instance);
+ }
} else if (m != null && m.binding == MemberBinding.CLASS) {
var cl = (Class) m.parent_symbol;
var cast = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_upper_case_name (cl, null) + "_CLASS"));
if (!cl.is_compact && vcall == null && (direction & 1) == 1) {
cparam_map.set (get_param_pos (get_ccode_instance_pos (m)), new CCodeParameter ("object_type", "GType"));
}
- } else if (m.binding == MemberBinding.INSTANCE || (m.parent_symbol is Struct && m is CreationMethod)) {
+ } else if ((m.binding == MemberBinding.INSTANCE || (m.parent_symbol is Struct && m is CreationMethod))
+ && (direction != 2 || get_ccode_finish_instance (m))) {
TypeSymbol parent_type = find_parent_type (m);
DataType this_type;
if (parent_type is Class) {
DESTROYS_INSTANCE,
BASE_TYPE,
FINISH_NAME,
+ FINISH_INSTANCE,
SYMBOL_TYPE,
INSTANCE_IDX,
EXPERIMENTAL,
if (metadata.has_argument (ArgumentType.FINISH_NAME)) {
s.set_attribute_string ("CCode", "finish_name", metadata.get_string (ArgumentType.FINISH_NAME));
}
+ if (metadata.has_argument (ArgumentType.FINISH_INSTANCE)) {
+ s.set_attribute_bool ("CCode", "finish_instance", metadata.get_bool (ArgumentType.FINISH_INSTANCE));
+ }
int instance_idx = -2;
if (element_name == "function" && symbol_type == "method") {
"has_copy_function", "lower_case_csuffix", "ref_sink_function", "dup_function", "finish_function", "generic_type_pos",
"array_length_type", "array_length", "array_length_cname", "array_length_cexpr", "array_null_terminated",
"vfunc_name", "finish_vfunc_name", "finish_name", "free_function_address_of", "pos", "delegate_target", "delegate_target_cname",
- "array_length_pos", "delegate_target_pos", "destroy_notify_pos", "ctype", "has_new_function", "notify", "",
+ "array_length_pos", "delegate_target_pos", "destroy_notify_pos", "ctype", "has_new_function", "notify", "finish_instance", "",
"Immutable", "",
"Compact", "",