return result;
}
- public LocalVariable get_temp_variable (DataType type, bool value_owned = true, CodeNode? node_reference = null, bool init = true) {
+ public LocalVariable get_temp_variable (DataType type, bool value_owned = true, CodeNode? node_reference = null, bool init = false) {
var var_type = type.copy ();
var_type.value_owned = value_owned;
var local = new LocalVariable (var_type, "_tmp%d_".printf (next_temp_var_id));
ccall.add_argument (pub_inst);
}
- var temp_value = (GLibValue) create_temp_value (prop.get_accessor.value_type, false, expr);
+ bool prop_is_real_non_null_struct_type = prop.property_type.is_real_non_null_struct_type ();
+ var temp_value = (GLibValue) create_temp_value (prop.get_accessor.value_type, prop_is_real_non_null_struct_type, expr);
expr.target_value = load_temp_value (temp_value);
var ctemp = get_cvalue_ (temp_value);
// Property access to real struct types is handled differently
// The value is returned by out parameter
- if (prop.property_type.is_real_non_null_struct_type ()) {
+ if (prop_is_real_non_null_struct_type) {
ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, ctemp));
ccode.add_expression (ccall);
} else {
} else {
arg.target_value = null;
- var temp_var = get_temp_variable (param.variable_type, param.variable_type.value_owned);
+ var temp_var = get_temp_variable (param.variable_type, param.variable_type.value_owned, null, true);
emit_temp_var (temp_var);
set_cvalue (arg, get_variable_cexpression (temp_var.name));
arg.target_value.value_type = arg.target_type;
var deleg_type = (DelegateType) param.variable_type;
var d = deleg_type.delegate_symbol;
if (d.has_target) {
- temp_var = get_temp_variable (new PointerType (new VoidType ()));
+ temp_var = get_temp_variable (new PointerType (new VoidType ()), true, null, true);
emit_temp_var (temp_var);
set_delegate_target (arg, get_variable_cexpression (temp_var.name));
carg_map.set (get_param_pos (get_ccode_delegate_target_pos (param)), new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, get_delegate_target (arg)));
if (deleg_type.is_disposable ()) {
- temp_var = get_temp_variable (gdestroynotify_type);
+ temp_var = get_temp_variable (gdestroynotify_type, true, null, true);
emit_temp_var (temp_var);
set_delegate_target_destroy_notify (arg, get_variable_cexpression (temp_var.name));
carg_map.set (get_param_pos (get_ccode_delegate_target_pos (param) + 0.01), new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, get_delegate_target_destroy_notify (arg)));
CCodeExpression out_param_ref = null;
if (return_result_via_out_param) {
- var out_param_var = get_temp_variable (itype.get_return_type ());
+ var out_param_var = get_temp_variable (itype.get_return_type (), true, null, true);
out_param_ref = get_variable_cexpression (out_param_var.name);
emit_temp_var (out_param_var);
out_arg_map.set (get_param_pos (-3), new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, out_param_ref));
if (m != null && m.get_format_arg_index () >= 0) {
set_cvalue (expr, ccall_expr);
} else if (!return_result_via_out_param) {
- var temp_var = get_temp_variable (result_type, result_type.value_owned);
+ var temp_var = get_temp_variable (result_type, result_type.value_owned, null, false);
var temp_ref = get_variable_cexpression (temp_var.name);
emit_temp_var (temp_var);