[vala/0.42] codegen: Cast instance parameter for property access in object-initializer



commit 44e83fc03c60054b7b3ab0dbb585e61fd853d92c
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Fri Jan 4 19:18:11 2019 +0100

    codegen: Cast instance parameter for property access in object-initializer
    
    This will silence those incompatible-pointer-types warnings

 codegen/valaccodebasemodule.vala | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 327da2726..89ed181a8 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -5039,10 +5039,12 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                                generate_class_struct_declaration (cl, cfile);
                                        }
                                } else if (init.symbol_reference is Property) {
-                                       var inst_ma = new MemberAccess.simple ("new");
-                                       inst_ma.value_type = expr.type_reference;
-                                       set_cvalue (inst_ma, instance);
-                                       store_property ((Property) init.symbol_reference, inst_ma, 
init.initializer.target_value);
+                                       var p = (Property) init.symbol_reference;
+                                       var instance_target_type = get_data_type_for_symbol ((TypeSymbol) 
p.parent_symbol);
+                                       var typed_inst = transform_value (new GLibValue (expr.type_reference, 
instance), instance_target_type, init);
+                                       var inst_ma = new MemberAccess.simple ("fake");
+                                       inst_ma.target_value = typed_inst;
+                                       store_property (p, inst_ma, init.initializer.target_value);
                                        // FIXME Do not ref/copy in the first place
                                        if (requires_destroy (init.initializer.target_value.value_type)) {
                                                ccode.add_expression (destroy_value 
(init.initializer.target_value));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]