[vala] Transfer ownership of owned value parameter in set accessor
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] Transfer ownership of owned value parameter in set accessor
- Date: Thu, 9 Jun 2011 11:49:38 +0000 (UTC)
commit af723b4c4e500c9070a36184d75660b9aa3442f1
Author: Luca Bruno <lucabru src gnome org>
Date: Thu Jun 9 13:32:04 2011 +0200
Transfer ownership of owned value parameter in set accessor
vala/valapropertyaccessor.vala | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/vala/valapropertyaccessor.vala b/vala/valapropertyaccessor.vala
index fbec601..dc4a8b3 100644
--- a/vala/valapropertyaccessor.vala
+++ b/vala/valapropertyaccessor.vala
@@ -187,7 +187,11 @@ public class Vala.PropertyAccessor : Subroutine {
body.add_statement (new ReturnStatement (ma, source_reference));
}
} else {
- var assignment = new Assignment (ma, new MemberAccess.simple ("value", source_reference), AssignmentOperator.SIMPLE, source_reference);
+ Expression value = new MemberAccess.simple ("value", source_reference);
+ if (value_type.value_owned) {
+ value = new ReferenceTransferExpression (value, source_reference);
+ }
+ var assignment = new Assignment (ma, value, AssignmentOperator.SIMPLE, source_reference);
body.add_statement (new ExpressionStatement (assignment));
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]