[vala/staging: 1/2] codegen: Don't implicitly initialize local variables with an initializer
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging: 1/2] codegen: Don't implicitly initialize local variables with an initializer
- Date: Thu, 10 Nov 2016 14:46:49 +0000 (UTC)
commit f5c654f76eeb1ee887f3d89eb701cf82f75a430a
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Thu Nov 10 11:52:16 2016 +0100
codegen: Don't implicitly initialize local variables with an initializer
codegen/valaccodebasemodule.vala | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index a95023c..939b256 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -2358,7 +2358,9 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
// try to initialize uninitialized variables
// initialization not necessary for variables stored in closure
- cvar.initializer = default_value_for_type (local.variable_type, true);
+ if (local.initializer == null) {
+ cvar.initializer = default_value_for_type (local.variable_type, true);
+ }
cvar.init0 = true;
ccode.add_declaration (get_ccode_name (local.variable_type), cvar);
@@ -3488,7 +3490,9 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
} else {
var cvar = new CCodeVariableDeclarator (local.name, null, get_ccode_declarator_suffix
(local.variable_type));
if (init) {
- cvar.initializer = default_value_for_type (local.variable_type, true);
+ if (local.initializer == null) {
+ 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]