]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Always copy struct on access only when it's non-nullable
authorLuca Bruno <lucabru@src.gnome.org>
Tue, 16 Aug 2011 20:36:05 +0000 (22:36 +0200)
committerLuca Bruno <lucabru@src.gnome.org>
Tue, 16 Aug 2011 21:16:28 +0000 (23:16 +0200)
We currently don't copy the nullable struct, only the reference,
therefore useless.

codegen/valaccodememberaccessmodule.vala

index 569e1dc0a2c3a3c624fbc2f8d08adfd9b052a479..2978ce8cface3b27e46d8fe243a372b66c4679c0 100644 (file)
@@ -697,7 +697,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
                if (variable is Parameter && variable.name == "this") {
                        use_temp = false;
                }
-               if (variable.single_assignment && !result.value_type.is_real_struct_type ()) {
+               if (variable.single_assignment && !result.value_type.is_real_non_null_struct_type ()) {
                        // no need to copy values from variables that are assigned exactly once
                        // as there is no risk of modification
                        // except for structs that are always passed by reference