[vala] codegen: Fix types of temporary variables when using GArray or va_list
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] codegen: Fix types of temporary variables when using GArray or va_list
- Date: Sun, 10 Oct 2010 21:08:31 +0000 (UTC)
commit e73564402dcc4485254d96fc04642ca85e017733
Author: Jürg Billeter <j bitron ch>
Date: Sun Oct 10 22:59:03 2010 +0200
codegen: Fix types of temporary variables when using GArray or va_list
codegen/valaccodemethodcallmodule.vala | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index 0b5e879..540a54c 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -793,7 +793,20 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
if (expr.parent_node is ExpressionStatement) {
ccode.add_expression (ccall_expr);
} else {
- var temp_var = get_temp_variable (itype.get_return_type ());
+ var result_type = itype.get_return_type ();
+
+ if (expr.formal_value_type is GenericType && !(expr.value_type is GenericType)) {
+ var st = expr.formal_value_type.type_parameter.parent_symbol.parent_symbol as Struct;
+ if (expr.formal_value_type.type_parameter.parent_symbol == garray_type ||
+ (st != null && st.get_cname () == "va_list")) {
+ // GArray and va_list don't use pointer-based generics
+ // above logic copied from visit_expression ()
+ // TODO avoid code duplication
+ result_type = expr.value_type;
+ }
+ }
+
+ var temp_var = get_temp_variable (result_type);
var temp_ref = get_variable_cexpression (temp_var.name);
emit_temp_var (temp_var);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]