]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Always analyze nodes after they are inserted into the AST
authorLuca Bruno <lucabru@src.gnome.org>
Fri, 5 Aug 2011 15:22:18 +0000 (17:22 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Tue, 23 Oct 2018 16:45:42 +0000 (18:45 +0200)
vala/valaassignment.vala
vala/valabinaryexpression.vala
vala/valaconditionalexpression.vala
vala/valamethodcall.vala
vala/valaobjectcreationexpression.vala

index 8dfef11bda183350c5c89aefb09ac92ef5de9807..98c9c77c1a87f54ce3fd5b08897a050e8e7c9b75 100644 (file)
@@ -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);
index 6fac539fdb6c99a3be932db97006e203bb61bbe5..be62ed64da8bf308d69fcee38414406ae24db6b2 100644 (file)
@@ -170,7 +170,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);
 
@@ -192,6 +191,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;
@@ -200,10 +201,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;
                }
 
@@ -281,10 +283,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;
                }
 
index 71acf6d5380a3c05882874b44561d74dfbf43c02..98facaaed512ce60d3201a9f57c75c1798bb9d02 100644 (file)
@@ -174,20 +174,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;
        }
index 8f68dc4bd40e4aff4b9464277b34f6c80d0e7595..082e061f7d3b1bc128064eb9db441219cd14d1bd 100644 (file)
@@ -649,7 +649,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
index fa419fd22637712caaa01f9617a244e66e242fdb..8bef09b25f7b3d52499453efd3b55115ceebf737 100644 (file)
@@ -504,7 +504,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