[vala/wip/effectfree: 12/38] codegen: Use temporary variables when accessing a variable
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/effectfree: 12/38] codegen: Use temporary variables when accessing a variable
- Date: Mon, 27 Jun 2011 11:47:59 +0000 (UTC)
commit 4096f6597653a16208c26d34fb95a3c35c711e26
Author: Luca Bruno <lucabru src gnome org>
Date: Wed Jun 15 13:27:21 2011 +0200
codegen: Use temporary variables when accessing a variable
Fixes bugs 626038 and 572091..
codegen/valaccodememberaccessmodule.vala | 5 +++++
tests/Makefile.am | 1 +
tests/objects/bug626038.vala | 8 ++++++++
3 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/codegen/valaccodememberaccessmodule.vala b/codegen/valaccodememberaccessmodule.vala
index 443992f..c00ec8b 100644
--- a/codegen/valaccodememberaccessmodule.vala
+++ b/codegen/valaccodememberaccessmodule.vala
@@ -698,6 +698,11 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
result.delegate_target_destroy_notify_cvalue = new CCodeConstant ("NULL");
}
result.value_type.value_owned = false;
+
+ if (!(variable is Parameter && variable.name == "this") && !(array_type != null && array_type.inline_allocated)) {
+ result = (GLibValue) store_temp_value (result, variable);
+ }
+
return result;
}
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9819401..611ec01 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -88,6 +88,7 @@ TESTS = \
objects/bug613840.vala \
objects/bug620706.vala \
objects/bug624594.vala \
+ objects/bug626038.vala \
objects/bug628639.vala \
objects/bug642809.vala \
objects/bug643711.vala \
diff --git a/tests/objects/bug626038.vala b/tests/objects/bug626038.vala
new file mode 100644
index 0000000..3c1f875
--- /dev/null
+++ b/tests/objects/bug626038.vala
@@ -0,0 +1,8 @@
+class Foo {
+ public Foo foo;
+}
+
+void main () {
+ var foo = new Foo ();
+ foo.foo = (owned) foo;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]