[vala/staging: 71/91] Copy types in transformer
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging: 71/91] Copy types in transformer
- Date: Mon, 3 Feb 2014 23:19:46 +0000 (UTC)
commit a7b267332e59478deb4b65b604373265251b010e
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 | 14 +++++++-------
vala/valareturnstatement.vala | 2 +-
5 files changed, 16 insertions(+), 16 deletions(-)
---
diff --git a/codegen/valaccodetransformer.vala b/codegen/valaccodetransformer.vala
index bd64fb0..6473a99 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 7a30b6a..b47c29a 100644
--- a/codegen/valagdbusclienttransformer.vala
+++ b/codegen/valagdbusclienttransformer.vala
@@ -144,7 +144,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 ());
}
@@ -207,7 +207,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 ()) {
@@ -358,7 +358,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 ecae793..1e18425 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 7547fe6..5784fa9 100644
--- a/vala/valaassignment.vala
+++ b/vala/valaassignment.vala
@@ -226,10 +226,10 @@ public class Vala.Assignment : Expression {
parent_node.replace_expression (this, set_call);
return set_call.check (context);
} else {
- right.target_type = left.value_type;
+ right.target_type = left.value_type.copy ();
}
} else if (left is PointerIndirection) {
- right.target_type = left.value_type;
+ right.target_type = left.value_type.copy ();
} else {
error = true;
Report.error (source_reference, "unsupported lvalue in assignment");
@@ -253,7 +253,7 @@ public class Vala.Assignment : Expression {
var old_value = new MemberAccess (ma.inner, ma.member_name);
var bin = new BinaryExpression (BinaryOperator.PLUS, old_value, right,
source_reference);
- bin.target_type = right.target_type;
+ bin.target_type = right.target_type.copy ();
right.target_type = right.target_type.copy ();
right.target_type.value_owned = false;
@@ -311,7 +311,7 @@ public class Vala.Assignment : Expression {
}
right.target_type = new DelegateType (sig.get_delegate (new ObjectType
((ObjectTypeSymbol) sig.parent_symbol), this));
} else if (!right.value_type.compatible (right.target_type)) {
- var delegate_type = (DelegateType) right.target_type;
+ var delegate_type = (DelegateType) right.target_type.copy ();
error = true;
Report.error (right.source_reference, "method `%s' is incompatible with
signal `%s', expected `%s'".printf (right.value_type.to_string (), right.target_type.to_string (),
delegate_type.delegate_symbol.get_prototype_string (m.name)));
@@ -357,7 +357,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 */
@@ -367,7 +367,7 @@ public class Vala.Assignment : Expression {
return false;
}
- right.value_type = variable.variable_type;
+ right.value_type = variable.variable_type.copy ();
} else {
error = true;
Report.error (source_reference, "Assignment: Invalid assignment
attempt");
@@ -436,7 +436,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);
diff --git a/vala/valareturnstatement.vala b/vala/valareturnstatement.vala
index 452fd20..2280c3a 100644
--- a/vala/valareturnstatement.vala
+++ b/vala/valareturnstatement.vala
@@ -86,7 +86,7 @@ public class Vala.ReturnStatement : BaseStatement {
var current_return_type = context.analyzer.get_current_return_type (this);
if (return_expression != null) {
- return_expression.target_type = current_return_type;
+ return_expression.target_type = current_return_type.copy ();
}
if (return_expression != null && !return_expression.check (context)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]