[vala] codegen: Make creation of InitiallyUnowned objects be effect-free
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] codegen: Make creation of InitiallyUnowned objects be effect-free
- Date: Mon, 1 Aug 2011 11:51:08 +0000 (UTC)
commit fa4bd4b947a34b2553e6a4e1dfe32fdc5cff5379
Author: Luca Bruno <lucabru src gnome org>
Date: Sun Jul 31 12:35:33 2011 +0200
codegen: Make creation of InitiallyUnowned objects be effect-free
codegen/valagobjectmodule.vala | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/codegen/valagobjectmodule.vala b/codegen/valagobjectmodule.vala
index 8fe42c0..08db5cf 100644
--- a/codegen/valagobjectmodule.vala
+++ b/codegen/valagobjectmodule.vala
@@ -731,16 +731,13 @@ public class Vala.GObjectModule : GTypeModule {
// runtime check to ref_sink the instance if it's a floating type
base.visit_method_call (expr);
- var temp_var = get_temp_variable (expr.value_type, false, expr, false);
- emit_temp_var (temp_var);
- ccode.add_assignment (get_variable_cexpression (temp_var.name), get_cvalue (expr));
-
var initiallyunowned_ccall = new CCodeFunctionCall (new CCodeIdentifier ("G_IS_INITIALLY_UNOWNED"));
- initiallyunowned_ccall.add_argument (get_variable_cexpression (temp_var.name));
+ initiallyunowned_ccall.add_argument (get_cvalue (expr));
var sink_ref_ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_object_ref_sink"));
- sink_ref_ccall.add_argument (get_variable_cexpression (temp_var.name));
+ sink_ref_ccall.add_argument (get_cvalue (expr));
+ var cexpr = new CCodeConditionalExpression (initiallyunowned_ccall, sink_ref_ccall, get_cvalue (expr));
- set_cvalue (expr, new CCodeConditionalExpression (initiallyunowned_ccall, sink_ref_ccall, get_variable_cexpression (temp_var.name)));
+ expr.target_value = store_temp_value (new GLibValue (expr.value_type, cexpr), expr);
return;
} else if (ma.symbol_reference == gobject_type) {
// Object (...) chain up
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]