[vala/wip/transform: 46/50] Do not handle binary expressions without parent statement



commit 3b4b865c60c0a39f6c39fd170fe07cefc4d4b6d9
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 a1f5859..ea70046 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);
@@ -402,10 +400,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]