[vala/wip/transform: 47/52] Do not handle binary expressions without parent statement



commit cdb985f2f149d9439e8592190991f27c2d890b99
Author: Luca Bruno <lucabru src gnome org>
Date:   Thu Feb 9 13:45:57 2012 +0100

    Do not handle binary expressions without parent statement

 codegen/valaccodetransformer.vala |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/codegen/valaccodetransformer.vala b/codegen/valaccodetransformer.vala
index be20da6..eccafda 100644
--- a/codegen/valaccodetransformer.vala
+++ b/codegen/valaccodetransformer.vala
@@ -210,8 +210,6 @@ public class Vala.CCodeTransformer : CodeTransformer {
 		// convert to simple loop
 		push_builder (new CodeBuilder (context, stmt, stmt.source_reference));
 
-		var block = new Block (stmt.source_reference);
-
 		// initializer
 		foreach (var init_expr in stmt.get_initializer ()) {
 			b.add_expression (init_expr);
@@ -400,10 +398,16 @@ public class Vala.CCodeTransformer : CodeTransformer {
 	}
 
 	public override void visit_binary_expression (BinaryExpression expr) {
+		var parent_statement = expr.parent_statement;
+		if (parent_statement == null) {
+			base.visit_binary_expression (expr);
+			return;
+		}
+
 		Expression replacement = null;
 		var old_parent_node = expr.parent_node;
 		var target_type = expr.target_type != null ? expr.target_type.copy () : null;
-		push_builder (new CodeBuilder (context, expr.parent_statement, expr.source_reference));
+		push_builder (new CodeBuilder (context, parent_statement, expr.source_reference));
 
 		if (context.analyzer.get_current_symbol (expr) is Block
 		    && (expr.operator == BinaryOperator.AND || expr.operator == BinaryOperator.OR)) {



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