[vala/wip/transform: 19/102] Several transformer fixes



commit 248158ada2cd7db64efdec2ad8d0ba260f03dea7
Author: Luca Bruno <lucabru src gnome org>
Date:   Thu Dec 29 12:39:15 2011 +0100

    Several transformer fixes

 codegen/valagvarianttransformer.vala | 2 ++
 vala/valacodetransformer.vala        | 6 ++++++
 vala/valaconditionalexpression.vala  | 6 ++----
 3 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/codegen/valagvarianttransformer.vala b/codegen/valagvarianttransformer.vala
index 1b177d531..5ff5abe7d 100644
--- a/codegen/valagvarianttransformer.vala
+++ b/codegen/valagvarianttransformer.vala
@@ -246,6 +246,8 @@ public class Vala.GVariantTransformer : CodeTransformer {
        }
 
        public override void visit_expression (Expression expr) {
+               base.visit_expression (expr);
+
                if (!(context.profile == Profile.GOBJECT && expr.target_type != null && 
expr.target_type.data_type == context.analyzer.gvariant_type.data_type && !(expr.value_type is NullType) && 
expr.value_type.data_type != context.analyzer.gvariant_type.data_type)) {
                        // no implicit gvariant boxing
                        return;
diff --git a/vala/valacodetransformer.vala b/vala/valacodetransformer.vala
index 9eefee84e..8583c1066 100644
--- a/vala/valacodetransformer.vala
+++ b/vala/valacodetransformer.vala
@@ -200,6 +200,7 @@ public class Vala.CodeTransformer : CodeVisitor {
                var loop = new Loop (stmt.body, stmt.source_reference);
 
                var parent_block = (Block) stmt.parent_node;
+               context.analyzer.replaced_nodes.add (stmt);
                parent_block.replace_statement (stmt, loop);
 
                stmt.body.checked = false;
@@ -214,6 +215,7 @@ public class Vala.CodeTransformer : CodeVisitor {
                        var loop = new Loop (stmt.body, stmt.source_reference);
 
                        var parent_block = (Block) stmt.parent_node;
+                       context.analyzer.replaced_nodes.add (stmt);
                        parent_block.replace_statement (stmt, loop);
 
                        check (loop);
@@ -241,6 +243,7 @@ public class Vala.CodeTransformer : CodeVisitor {
                block.add_statement (new Loop (stmt.body, stmt.source_reference));
 
                var parent_block = (Block) stmt.parent_node;
+               context.analyzer.replaced_nodes.add (stmt);
                parent_block.replace_statement (stmt, block);
 
                stmt.body.checked = false;
@@ -287,6 +290,7 @@ public class Vala.CodeTransformer : CodeVisitor {
                block.add_statement (new Loop (stmt.body, stmt.source_reference));
 
                var parent_block = (Block) stmt.parent_node;
+               context.analyzer.replaced_nodes.add (stmt);
                parent_block.replace_statement (stmt, block);
 
                stmt.body.checked = false;
@@ -370,6 +374,7 @@ public class Vala.CodeTransformer : CodeVisitor {
                                block.remove_local_variable (local);
                                context.analyzer.get_insert_block (expr).add_local_variable (local);
 
+                               context.analyzer.replaced_nodes.add (expr);
                                old_parent_node.replace_expression (expr, temp_access);
                                check (temp_access);
                        }
@@ -400,6 +405,7 @@ public class Vala.CodeTransformer : CodeVisitor {
                ma.formal_target_type = expr.formal_target_type;
                ma.target_type = expr.target_type;
 
+               context.analyzer.replaced_nodes.add (expr);
                expr.parent_node.replace_expression (expr, ma);
                check (ma);
        }
diff --git a/vala/valaconditionalexpression.vala b/vala/valaconditionalexpression.vala
index be317b1c7..4a0ceb45b 100644
--- a/vala/valaconditionalexpression.vala
+++ b/vala/valaconditionalexpression.vala
@@ -85,11 +85,9 @@ public class Vala.ConditionalExpression : Expression {
        }
 
        public override void accept (CodeVisitor visitor) {
-               // FIXME: temporary workaround to keep alive the object
-               var self = this;
-               visitor.visit_conditional_expression (self);
+               visitor.visit_conditional_expression (this);
 
-               visitor.visit_expression (self);
+               visitor.visit_expression (this);
        }
 
        public override void accept_children (CodeVisitor visitor) {


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