Commit cd098ddc authored by Jürg Billeter's avatar Jürg Billeter

Do not generate C code for unreachable Vala code

Fixes bug 598190.
parent cbf48b15
......@@ -1897,7 +1897,7 @@ internal class Vala.CCodeBaseModule : CCodeModule {
}
foreach (CodeNode stmt in b.get_statements ()) {
if (stmt.error) {
if (stmt.error || stmt.unreachable) {
continue;
}
......
/* valacodenode.vala
*
* Copyright (C) 2006-2009 Jürg Billeter
* Copyright (C) 2006-2010 Jürg Billeter
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -39,7 +39,9 @@ public abstract class Vala.CodeNode {
* been written.
*/
public SourceReference? source_reference { get; set; }
public bool unreachable { get; set; }
/**
* Contains all attributes that have been specified for this code node.
*/
......
......@@ -1023,6 +1023,7 @@ public class Vala.FlowAnalyzer : CodeVisitor {
private bool unreachable (CodeNode node) {
if (current_block == null) {
node.unreachable = true;
if (!unreachable_reported) {
Report.warning (node.source_reference, "unreachable code detected");
unreachable_reported = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment