[vala] Fix code generation for unreachable declaration statements
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] Fix code generation for unreachable declaration statements
- Date: Wed, 31 Mar 2010 14:55:28 +0000 (UTC)
commit 10bc7c02c6e772316e4178b50f3071e396d5a054
Author: Jürg Billeter <j bitron ch>
Date: Wed Mar 31 16:45:16 2010 +0200
Fix code generation for unreachable declaration statements
codegen/valaccodebasemodule.vala | 6 +++---
vala/valaflowanalyzer.vala | 1 +
2 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 01e5fa6..6bbd100 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -1940,7 +1940,7 @@ internal class Vala.CCodeBaseModule : CCodeModule {
}
foreach (LocalVariable local in local_vars) {
- if (!local.floating && !local.captured && requires_destroy (local.variable_type)) {
+ if (!local.unreachable && !local.floating && !local.captured && requires_destroy (local.variable_type)) {
var ma = new MemberAccess.simple (local.name);
ma.symbol_reference = local;
ma.value_type = local.variable_type.copy ();
@@ -3168,7 +3168,7 @@ internal class Vala.CCodeBaseModule : CCodeModule {
var local_vars = b.get_local_variables ();
foreach (LocalVariable local in local_vars) {
- if (local.active && !local.floating && !local.captured && requires_destroy (local.variable_type)) {
+ if (!local.unreachable && local.active && !local.floating && !local.captured && requires_destroy (local.variable_type)) {
var ma = new MemberAccess.simple (local.name);
ma.symbol_reference = local;
ma.value_type = local.variable_type.copy ();
@@ -3204,7 +3204,7 @@ internal class Vala.CCodeBaseModule : CCodeModule {
var local_vars = b.get_local_variables ();
foreach (LocalVariable local in local_vars) {
- if (local.active && !local.floating && !local.captured && requires_destroy (local.variable_type)) {
+ if (!local.unreachable && local.active && !local.floating && !local.captured && requires_destroy (local.variable_type)) {
var ma = new MemberAccess.simple (local.name);
ma.symbol_reference = local;
cfrag.append (new CCodeExpressionStatement (get_unref_expression (get_variable_cexpression (local.name), local.variable_type, ma)));
diff --git a/vala/valaflowanalyzer.vala b/vala/valaflowanalyzer.vala
index 9a04e1b..d95ef5f 100644
--- a/vala/valaflowanalyzer.vala
+++ b/vala/valaflowanalyzer.vala
@@ -530,6 +530,7 @@ public class Vala.FlowAnalyzer : CodeVisitor {
public override void visit_declaration_statement (DeclarationStatement stmt) {
if (unreachable (stmt)) {
+ stmt.declaration.unreachable = true;
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]