[vala/wip/transform: 71/102] Copy types in transformer



commit 70cd4ea81ac80abf545440c0f91652b02d9db826
Author: Luca Bruno <lucabru src gnome org>
Date:   Sat May 18 12:39:22 2013 +0200

    Copy types in transformer

 codegen/valaccodetransformer.vala       | 6 +++---
 codegen/valagdbusclienttransformer.vala | 6 +++---
 codegen/valagdbusservertransformer.vala | 4 ++--
 vala/valaassignment.vala                | 4 ++--
 4 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/codegen/valaccodetransformer.vala b/codegen/valaccodetransformer.vala
index bd64fb030..6473a99ca 100644
--- a/codegen/valaccodetransformer.vala
+++ b/codegen/valaccodetransformer.vala
@@ -374,10 +374,10 @@ public class Vala.CCodeTransformer : CodeTransformer {
                                push_builder (new CodeBuilder (context, expr.parent_statement, 
expr.source_reference));
 
                                // FIXME: use create_temp_access behavior
-                               var replacement = expression (b.add_temp_declaration (expr.value_type, expr, 
true));
+                               var replacement = expression (b.add_temp_declaration (expr.value_type.copy 
(), expr, true));
 
-                               replacement.target_type = target_type;
-                               replacement.formal_target_type = formal_target_type;
+                               replacement.target_type = target_type.copy ();
+                               replacement.formal_target_type = formal_target_type.copy ();
                                context.analyzer.replaced_nodes.add (expr);
                                old_parent_node.replace_expression (expr, replacement);
                                b.check (this);
diff --git a/codegen/valagdbusclienttransformer.vala b/codegen/valagdbusclienttransformer.vala
index 180e80e95..93ce6dff8 100644
--- a/codegen/valagdbusclienttransformer.vala
+++ b/codegen/valagdbusclienttransformer.vala
@@ -145,7 +145,7 @@ public class Vala.GDBusClientTransformer : GVariantTransformer {
        }
 
        void generate_dbus_proxy_method (Class proxy_class, Interface iface, Method m) {
-               var proxy = new Method (m.name, m.return_type, m.source_reference);
+               var proxy = new Method (m.name, m.return_type.copy(), m.source_reference);
                foreach (var param in m.get_parameters ()) {
                        proxy.add_parameter (param.copy ());
                }
@@ -208,7 +208,7 @@ public class Vala.GDBusClientTransformer : GVariantTransformer {
 
        void generate_dbus_proxy_signals (Class proxy_class, ObjectTypeSymbol sym) {
                var g_signal = (Signal) symbol_from_string ("GLib.DBusProxy.g_signal");
-               var m = new Method ("g_signal", g_signal.return_type, sym.source_reference);
+               var m = new Method ("g_signal", g_signal.return_type.copy(), sym.source_reference);
                m.overrides = true;
                m.access = SymbolAccessibility.PUBLIC;
                foreach (var param in g_signal.get_parameters ()) {
@@ -359,7 +359,7 @@ public class Vala.GDBusClientTransformer : GVariantTransformer {
                foreach (var param in m.get_parameters ()) {
                        cache_key = "%s %s".printf (cache_key, param.variable_type.to_string ());
                }
-               if (!wrapper_method (m.return_type, cache_key, out wrapper, symbol_from_string 
("GLib.DBusProxy"))) {
+               if (!wrapper_method (m.return_type.copy(), cache_key, out wrapper, symbol_from_string 
("GLib.DBusProxy"))) {
                        foreach (var param in m.get_parameters ()) {
                                wrapper.add_parameter (param.copy ());
                        }
diff --git a/codegen/valagdbusservertransformer.vala b/codegen/valagdbusservertransformer.vala
index 223663eb5..570c744e1 100644
--- a/codegen/valagdbusservertransformer.vala
+++ b/codegen/valagdbusservertransformer.vala
@@ -94,7 +94,7 @@ public class Vala.GDBusServerTransformer : GDBusClientTransformer {
                                }
                                var arg = b.add_temp_declaration (copy_type (param.variable_type, true));
                                out_args += arg;
-                               out_types += param.variable_type;
+                               out_types += param.variable_type.copy ();
                                finish_call.add_argument (new UnaryExpression (UnaryOperator.OUT, expression 
(arg), m.source_reference));
                                if (m.coroutine) {
                                        pop_builder ();
@@ -128,7 +128,7 @@ public class Vala.GDBusServerTransformer : GDBusClientTransformer {
                        write_dbus_value (out_types[i], builder, out_args[i], ref fd_list);
                }
                if (result != null) {
-                       write_dbus_value (m.return_type, builder, result, ref fd_list);
+                       write_dbus_value (m.return_type.copy (), builder, result, ref fd_list);
                }
                b.add_expression (expression (@"$reply.set_body ($builder.end ())"));
                if (fd_list != null) {
diff --git a/vala/valaassignment.vala b/vala/valaassignment.vala
index 898b099ca..c20ccc002 100644
--- a/vala/valaassignment.vala
+++ b/vala/valaassignment.vala
@@ -308,7 +308,7 @@ public class Vala.Assignment : Expression {
                                if (right.symbol_reference is Method &&
                                    variable.variable_type is DelegateType) {
                                        var m = (Method) right.symbol_reference;
-                                       var dt = (DelegateType) variable.variable_type;
+                                       var dt = (DelegateType) variable.variable_type.copy ();
                                        var cb = dt.delegate_symbol;
 
                                        /* check whether method matches callback type */
@@ -387,7 +387,7 @@ public class Vala.Assignment : Expression {
 
                                if (ea.container.value_type is ArrayType) {
                                        var array_type = (ArrayType) ea.container.value_type;
-                                       element_type = array_type.element_type;
+                                       element_type = array_type.element_type.copy ();
                                } else {
                                        var args = ea.container.value_type.get_type_arguments ();
                                        assert (args.size == 1);


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