[vala/staging] Revert "codegen: Don't implicitly initialize local variables with an initializer"



commit 10c668de04c6e44a9919d6ca5a4976e81d9bbc32
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Tue May 2 14:09:41 2017 +0200

    Revert "codegen: Don't implicitly initialize local variables with an initializer"
    
    This reverts commit f5c654f76eeb1ee887f3d89eb701cf82f75a430a.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=782056

 codegen/valaccodebasemodule.vala |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 3e51c96..f083e98 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -2373,9 +2373,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                                // try to initialize uninitialized variables
                                // initialization not necessary for variables stored in closure
-                               if (local.initializer == null) {
-                                       cvar.initializer = default_value_for_type (local.variable_type, true);
-                               }
+                               cvar.initializer = default_value_for_type (local.variable_type, true);
                                cvar.init0 = true;
 
                                ccode.add_declaration (get_ccode_name (local.variable_type), cvar);
@@ -3505,9 +3503,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                } else {
                        var cvar = new CCodeVariableDeclarator (local.name, null, get_ccode_declarator_suffix 
(local.variable_type));
                        if (init) {
-                               if (local.initializer == null) {
-                                       cvar.initializer = default_value_for_type (local.variable_type, true);
-                               }
+                               cvar.initializer = default_value_for_type (local.variable_type, true);
                                cvar.init0 = true;
                        }
                        ccode.add_declaration (get_ccode_name (local.variable_type), cvar);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]