[vala/0.36] vala: Always analyze nodes after they are inserted into the AST



commit 7b02b127174704fdf3fc3f9753bb2769b8815ff3
Author: Luca Bruno <lucabru src gnome org>
Date:   Fri Aug 5 17:22:18 2011 +0200

    vala: Always analyze nodes after they are inserted into the AST

 vala/valaassignment.vala               | 4 ++--
 vala/valabinaryexpression.vala         | 9 ++++++---
 vala/valaconditionalexpression.vala    | 6 +++---
 vala/valamethodcall.vala               | 1 -
 vala/valaobjectcreationexpression.vala | 1 -
 5 files changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/vala/valaassignment.vala b/vala/valaassignment.vala
index 7a3dae14f..c146b8ae1 100644
--- a/vala/valaassignment.vala
+++ b/vala/valaassignment.vala
@@ -113,15 +113,15 @@ public class Vala.Assignment : Expression {
 
                        var local = new LocalVariable (null, get_temp_name (), right, right.source_reference);
                        var decl = new DeclarationStatement (local, source_reference);
-                       decl.check (context);
                        insert_statement (context.analyzer.insert_block, decl);
+                       decl.check (context);
 
                        int i = 0;
                        ExpressionStatement stmt = null;
                        foreach (var expr in tuple.get_expressions ()) {
                                if (stmt != null) {
-                                       stmt.check (context);
                                        insert_statement (context.analyzer.insert_block, stmt);
+                                       stmt.check (context);
                                }
 
                                var temp_access = new MemberAccess.simple (local.name, 
right.source_reference);
diff --git a/vala/valabinaryexpression.vala b/vala/valabinaryexpression.vala
index 19287da85..0dcca8ee5 100644
--- a/vala/valabinaryexpression.vala
+++ b/vala/valabinaryexpression.vala
@@ -161,7 +161,6 @@ public class Vala.BinaryExpression : Expression {
 
                        var local = new LocalVariable (context.analyzer.bool_type.copy (), get_temp_name (), 
null, source_reference);
                        var decl = new DeclarationStatement (local, source_reference);
-                       decl.check (context);
 
                        var right_stmt = new ExpressionStatement (new Assignment (new MemberAccess.simple 
(local.name, right.source_reference), right, AssignmentOperator.SIMPLE, right.source_reference), 
right.source_reference);
 
@@ -183,6 +182,8 @@ public class Vala.BinaryExpression : Expression {
                        insert_statement (context.analyzer.insert_block, decl);
                        insert_statement (context.analyzer.insert_block, if_stmt);
 
+                       decl.check (context);
+
                        if (!if_stmt.check (context)) {
                                error = true;
                                return false;
@@ -191,10 +192,11 @@ public class Vala.BinaryExpression : Expression {
                        var ma = new MemberAccess.simple (local.name, source_reference);
                        ma.target_type = target_type;
                        ma.formal_target_type = formal_target_type;
-                       ma.check (context);
 
                        parent_node.replace_expression (this, ma);
 
+                       ma.check (context);
+
                        return true;
                }
 
@@ -272,10 +274,11 @@ public class Vala.BinaryExpression : Expression {
                                cast.target_type.nullable = false;
                                replace_expr = cast;
                        }
-                       replace_expr.check (context);
 
                        parent_node.replace_expression (this, replace_expr);
 
+                       replace_expr.check (context);
+
                        return true;
                }
 
diff --git a/vala/valaconditionalexpression.vala b/vala/valaconditionalexpression.vala
index 74cba969b..daf8b7a9e 100644
--- a/vala/valaconditionalexpression.vala
+++ b/vala/valaconditionalexpression.vala
@@ -173,20 +173,20 @@ public class Vala.ConditionalExpression : Expression {
                false_expression.target_type = value_type;
 
                var true_stmt = new ExpressionStatement (new Assignment (new MemberAccess.simple (local.name, 
true_expression.source_reference), true_expression, AssignmentOperator.SIMPLE, 
true_expression.source_reference), true_expression.source_reference);
-               true_stmt.check (context);
 
                var false_stmt = new ExpressionStatement (new Assignment (new MemberAccess.simple 
(local.name, false_expression.source_reference), false_expression, AssignmentOperator.SIMPLE, 
false_expression.source_reference), false_expression.source_reference);
-               false_stmt.check (context);
 
                true_block.replace_statement (true_decl, true_stmt);
                false_block.replace_statement (false_decl, false_stmt);
+               true_stmt.check (context);
+               false_stmt.check (context);
 
                var ma = new MemberAccess.simple (local.name, source_reference);
                ma.formal_target_type = formal_target_type;
                ma.target_type = target_type;
-               ma.check (context);
 
                parent_node.replace_expression (this, ma);
+               ma.check (context);
 
                return true;
        }
diff --git a/vala/valamethodcall.vala b/vala/valamethodcall.vala
index 76f240382..5df708e29 100644
--- a/vala/valamethodcall.vala
+++ b/vala/valamethodcall.vala
@@ -641,7 +641,6 @@ public class Vala.MethodCall : Expression {
                                local.initializer = this;
                                decl.check (context);
 
-
                                // move temp variable to insert block to ensure the
                                // variable is in the same block as the declaration
                                // otherwise there will be scoping issues in the generated code
diff --git a/vala/valaobjectcreationexpression.vala b/vala/valaobjectcreationexpression.vala
index e203a1a2b..1607ef9fe 100644
--- a/vala/valaobjectcreationexpression.vala
+++ b/vala/valaobjectcreationexpression.vala
@@ -500,7 +500,6 @@ public class Vala.ObjectCreationExpression : Expression {
                                local.initializer = this;
                                decl.check (context);
 
-
                                // move temp variable to insert block to ensure the
                                // variable is in the same block as the declaration
                                // otherwise there will be scoping issues in the generated code


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