[vala] codegen: Use separate C statements for D-Bus object registration
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] codegen: Use separate C statements for D-Bus object registration
- Date: Tue, 21 Dec 2010 18:02:42 +0000 (UTC)
commit 13d8390153e817437e28c78956d1f6aa8d734853
Author: Jürg Billeter <j bitron ch>
Date: Tue Dec 21 18:37:14 2010 +0100
codegen: Use separate C statements for D-Bus object registration
codegen/valadbusservermodule.vala | 3 ++-
codegen/valagdbusclientmodule.vala | 8 +++++++-
codegen/valagdbusservermodule.vala | 13 ++++++++++++-
3 files changed, 21 insertions(+), 3 deletions(-)
---
diff --git a/codegen/valadbusservermodule.vala b/codegen/valadbusservermodule.vala
index cb95b9b..d9acbd4 100644
--- a/codegen/valadbusservermodule.vala
+++ b/codegen/valadbusservermodule.vala
@@ -1664,7 +1664,8 @@ public class Vala.DBusServerModule : DBusClientModule {
}
cregister.add_argument (get_cvalue (path_arg));
cregister.add_argument (get_cvalue (obj_arg));
- set_cvalue (expr, cregister);
+
+ ccode.add_expression (cregister);
}
bool type_implements_dbus_interface (ObjectTypeSymbol sym) {
diff --git a/codegen/valagdbusclientmodule.vala b/codegen/valagdbusclientmodule.vala
index 4b945f3..f81320f 100644
--- a/codegen/valagdbusclientmodule.vala
+++ b/codegen/valagdbusclientmodule.vala
@@ -300,7 +300,13 @@ public class Vala.GDBusClientModule : GDBusModule {
}
}
- set_cvalue (expr, ccall);
+ var temp_var = get_temp_variable (expr.value_type, expr.value_type.value_owned);
+ var temp_ref = get_variable_cexpression (temp_var.name);
+
+ emit_temp_var (temp_var);
+
+ ccode.add_expression (new CCodeAssignment (temp_ref, ccall));
+ set_cvalue (expr, temp_ref);
}
string generate_dbus_signal_handler (Signal sig, ObjectTypeSymbol sym) {
diff --git a/codegen/valagdbusservermodule.vala b/codegen/valagdbusservermodule.vala
index 688b2d7..096539d 100644
--- a/codegen/valagdbusservermodule.vala
+++ b/codegen/valagdbusservermodule.vala
@@ -1139,7 +1139,18 @@ public class Vala.GDBusServerModule : GDBusClientModule {
cregister.add_argument (get_cvalue (ma.inner));
cregister.add_argument (get_cvalue (path_arg));
cregister.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, get_variable_cexpression ("_inner_error_")));
- set_cvalue (expr, cregister);
+
+ if (expr.parent_node is ExpressionStatement) {
+ ccode.add_expression (cregister);
+ } else {
+ var temp_var = get_temp_variable (expr.value_type, expr.value_type.value_owned);
+ var temp_ref = get_variable_cexpression (temp_var.name);
+
+ emit_temp_var (temp_var);
+
+ ccode.add_expression (new CCodeAssignment (temp_ref, cregister));
+ set_cvalue (expr, temp_ref);
+ }
}
public override void generate_class_declaration (Class cl, CCodeFile decl_space) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]