]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Don't use temp variable for stack allocated simple type assignment 32ffc862417be39d42a1b8eeb3d0748b3e138aff
authorRico Tzschichholz <ricotz@ubuntu.com>
Thu, 22 Nov 2018 13:58:34 +0000 (14:58 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Thu, 22 Nov 2018 14:07:00 +0000 (15:07 +0100)
codegen/valaccodememberaccessmodule.vala

index faf4545c9906118264358e90c56c259f5e9d1fba..06a4d2bb4b5c4d5627127cd5cc7d8ac6515ca269 100644 (file)
@@ -765,6 +765,10 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
                        // except for structs that are always passed by reference
                        use_temp = false;
                }
+               if (result.value_type.is_non_null_simple_type ()) {
+                       // no need to an extra copy of variables that are stack allocated simple types
+                       use_temp = false;
+               }
                var local = variable as LocalVariable;
                if (local != null && local.name[0] == '.') {
                        // already a temporary variable generated internally