summaryrefslogtreecommitdiff
path: root/vala/valaforstatement.vala
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2008-11-30 12:50:43 +0000
committerJürg Billeter <juergbi@src.gnome.org>2008-11-30 12:50:43 +0000
commit0697212ab726a72c826d27208181e026bf192cad (patch)
treef266a35833ce799ab33a2e3005031c69545fcf6b /vala/valaforstatement.vala
parent457053b12382af6629ee5c64d0b2615b5ca6083b (diff)
downloadvala-0697212ab726a72c826d27208181e026bf192cad.tar.gz
Fix error handling in condition of while, do, and for statements
2008-11-30 Jürg Billeter <j@bitron.ch> * vala/valaaddressofexpression.vala: * vala/valaarraycreationexpression.vala: * vala/valaassignment.vala: * vala/valabaseaccess.vala: * vala/valabinaryexpression.vala: * vala/valablock.vala: * vala/valacastexpression.vala: * vala/valaconditionalexpression.vala: * vala/valadostatement.vala: * vala/valaelementaccess.vala: * vala/valaexpression.vala: * vala/valaforstatement.vala: * vala/valainitializerlist.vala: * vala/valalambdaexpression.vala: * vala/valaliteral.vala: * vala/valamemberaccess.vala: * vala/valamethodcall.vala: * vala/valaobjectcreationexpression.vala: * vala/valaparenthesizedexpression.vala: * vala/valapointerindirection.vala: * vala/valapostfixexpression.vala: * vala/valareferencetransferexpression.vala: * vala/valasemanticanalyzer.vala: * vala/valasizeofexpression.vala: * vala/valaswitchsection.vala: * vala/valatuple.vala: * vala/valatypecheck.vala: * vala/valatypeofexpression.vala: * vala/valaunaryexpression.vala: * vala/valawhilestatement.vala: * gobject/valaccodebasemodule.vala: Fix error handling in condition of while, do, and for statements svn path=/trunk/; revision=2096
Diffstat (limited to 'vala/valaforstatement.vala')
-rw-r--r--vala/valaforstatement.vala30
1 files changed, 16 insertions, 14 deletions
diff --git a/vala/valaforstatement.vala b/vala/valaforstatement.vala
index ebd8de526..bdc048a52 100644
--- a/vala/valaforstatement.vala
+++ b/vala/valaforstatement.vala
@@ -164,20 +164,6 @@ public class Vala.ForStatement : CodeNode, Statement {
checked = true;
-
- if (condition != null && !condition.in_single_basic_block ()) {
- // move condition into the loop body to allow split
- // in multiple statements
-
- var if_condition = new UnaryExpression (UnaryOperator.LOGICAL_NEGATION, condition, condition.source_reference);
- var true_block = new Block (condition.source_reference);
- true_block.add_statement (new BreakStatement (condition.source_reference));
- var if_stmt = new IfStatement (if_condition, true_block, null, condition.source_reference);
- body.insert_statement (0, if_stmt);
-
- condition = new BooleanLiteral (true, source_reference);
- }
-
foreach (Expression init_expr in initializer) {
init_expr.check (analyzer);
}
@@ -218,4 +204,20 @@ public class Vala.ForStatement : CodeNode, Statement {
return !error;
}
+
+ public Block prepare_condition_split (SemanticAnalyzer analyzer) {
+ // move condition into the loop body to allow split
+ // in multiple statements
+
+ var if_condition = new UnaryExpression (UnaryOperator.LOGICAL_NEGATION, condition, condition.source_reference);
+ var true_block = new Block (condition.source_reference);
+ true_block.add_statement (new BreakStatement (condition.source_reference));
+ var if_stmt = new IfStatement (if_condition, true_block, null, condition.source_reference);
+ body.insert_statement (0, if_stmt);
+
+ condition = new BooleanLiteral (true, source_reference);
+ condition.check (analyzer);
+
+ return body;
+ }
}