[vala/wip/transform: 103/104] Fix gvariant unboxing



commit 9ec2f3e16c11f70b38af656999c5764f44c2f50e
Author: Luca Bruno <lucabru src gnome org>
Date:   Fri Mar 14 23:59:20 2014 +0100

    Fix gvariant unboxing

 codegen/valaccodetransformer.vala    |    2 +-
 codegen/valagvarianttransformer.vala |   13 ++++++-------
 2 files changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/codegen/valaccodetransformer.vala b/codegen/valaccodetransformer.vala
index a2c7bf8..7d8d5e8 100644
--- a/codegen/valaccodetransformer.vala
+++ b/codegen/valaccodetransformer.vala
@@ -333,7 +333,7 @@ public class Vala.CCodeTransformer : CodeTransformer {
                                // can't handle errors in field initializers
                                Report.error (expr.source_reference, "Field initializers must not throw 
errors");
                        } else {
-                               var formal_target_type = copy_type (expr.target_type);
+                               var formal_target_type = copy_type (expr.formal_target_type);
                                var target_type = copy_type (expr.target_type);
                                begin_replace_expression (expr);
 
diff --git a/codegen/valagvarianttransformer.vala b/codegen/valagvarianttransformer.vala
index 3886893..f181b04 100644
--- a/codegen/valagvarianttransformer.vala
+++ b/codegen/valagvarianttransformer.vala
@@ -501,7 +501,9 @@ public class Vala.GVariantTransformer : CCodeTransformer {
                        return;
                }
 
-               push_builder (new CodeBuilder (context, expr.parent_statement, expr.source_reference));
+               var formal_target_type = copy_type (expr.formal_target_type);
+               var target_type = copy_type (expr.target_type);
+               begin_replace_expression (expr);
                var type = expr.value_type;
 
                BasicTypeInfo basic_type;
@@ -526,12 +528,9 @@ public class Vala.GVariantTransformer : CCodeTransformer {
                        Report.error (type.source_reference, "GVariant deserialization of type `%s' is not 
supported".printf (type.to_string ()));
                }
 
-               context.analyzer.replaced_nodes.add (expr.inner);
-               expr.inner = result;
-               b.check (this);
-               pop_builder ();
-               expr.checked = false;
-               check (expr);
+               result.formal_target_type = formal_target_type;
+               result.target_type = target_type;
+               end_replace_expression (result);
        }
 
        public override void visit_expression (Expression expr) {


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