[vala/staging] codegen: Cast instance parameter for property access in object-initializer
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] codegen: Cast instance parameter for property access in object-initializer
- Date: Fri, 4 Jan 2019 18:51:48 +0000 (UTC)
commit 48de3bb60ddf01418fa390692e769d3038db9ea4
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 d63c4ae52..ae1ad0c2c 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -5070,10 +5070,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]