[vala] Fix postconditions for methods returning structs
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] Fix postconditions for methods returning structs
- Date: Sun, 21 Mar 2010 23:14:07 +0000 (UTC)
commit e1f191fd4eaa0db49eea122860d872b06a605197
Author: Adam Folmert <afolmert gmail com>
Date: Sun Feb 14 03:57:37 2010 +0100
Fix postconditions for methods returning structs
Fixes bug 602927.
codegen/valaccodememberaccessmodule.vala | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/codegen/valaccodememberaccessmodule.vala b/codegen/valaccodememberaccessmodule.vala
index edfa133..f55da36 100644
--- a/codegen/valaccodememberaccessmodule.vala
+++ b/codegen/valaccodememberaccessmodule.vala
@@ -355,7 +355,12 @@ internal class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
var local = (LocalVariable) expr.symbol_reference;
if (local.is_result) {
// used in postconditions
- expr.ccodenode = new CCodeIdentifier ("result");
+ // structs are returned as out parameter
+ if (local.variable_type != null && local.variable_type.is_real_non_null_struct_type ()) {
+ expr.ccodenode = new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeIdentifier ("result"));
+ } else {
+ expr.ccodenode = new CCodeIdentifier ("result");
+ }
} else if (local.captured) {
// captured variables are stored on the heap
var block = (Block) local.parent_symbol;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]