From 78a6e34f8883f32e368048f73b621dbbafd4b5dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Billeter?= Date: Tue, 2 Dec 2008 21:31:49 +0000 Subject: Resolve generic types when connecting signals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2008-12-02 Jürg Billeter * vala/valaassignment.vala: * vala/valasignal.vala: Resolve generic types when connecting signals svn path=/trunk/; revision=2115 --- ChangeLog | 7 +++++++ vala/valaassignment.vala | 6 +++--- vala/valasignal.vala | 10 +++++++--- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3bd4f8422..ca99887e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-12-02 Jürg Billeter + + * vala/valaassignment.vala: + * vala/valasignal.vala: + + Resolve generic types when connecting signals + 2008-12-02 Jürg Billeter * vala/valadatatype.vala: diff --git a/vala/valaassignment.vala b/vala/valaassignment.vala index d3ad077f7..cd870d19c 100644 --- a/vala/valaassignment.vala +++ b/vala/valaassignment.vala @@ -137,7 +137,7 @@ public class Vala.Assignment : Expression { // target_type not available for dynamic signals } else if (ma.symbol_reference is Signal) { var sig = (Signal) ma.symbol_reference; - right.target_type = new DelegateType (sig.get_delegate (ma.inner.value_type)); + right.target_type = new DelegateType (sig.get_delegate (ma.inner.value_type, this)); } else { right.target_type = ma.value_type; } @@ -147,7 +147,7 @@ public class Vala.Assignment : Expression { if (ea.container is MemberAccess && ea.container.symbol_reference is Signal) { var ma = (MemberAccess) ea.container; var sig = (Signal) ea.container.symbol_reference; - right.target_type = new DelegateType (sig.get_delegate (ma.inner.value_type)); + right.target_type = new DelegateType (sig.get_delegate (ma.inner.value_type, this)); } else { right.target_type = left.value_type; } @@ -231,7 +231,7 @@ public class Vala.Assignment : Expression { dynamic_sig.add_parameter (param.copy ()); } } - right.target_type = new DelegateType (sig.get_delegate (new ObjectType ((ObjectTypeSymbol) sig.parent_symbol))); + 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; diff --git a/vala/valasignal.vala b/vala/valasignal.vala index 3eec703c1..b4dcc7d2d 100644 --- a/vala/valasignal.vala +++ b/vala/valasignal.vala @@ -94,8 +94,10 @@ public class Vala.Signal : Member, Lockable { * * @return delegate */ - public Delegate get_delegate (DataType sender_type) { - var generated_delegate = new Delegate (null, return_type); + public Delegate get_delegate (DataType sender_type, CodeNode node_reference) { + var actual_return_type = return_type.get_actual_type (sender_type, node_reference); + + var generated_delegate = new Delegate (null, actual_return_type); generated_delegate.has_target = true; // sender parameter is never null and doesn't own its value @@ -107,7 +109,9 @@ public class Vala.Signal : Member, Lockable { generated_delegate.add_parameter (sender_param); foreach (FormalParameter param in parameters) { - generated_delegate.add_parameter (param.copy ()); + var actual_param = param.copy (); + actual_param.parameter_type = actual_param.parameter_type.get_actual_type (sender_type, node_reference); + generated_delegate.add_parameter (actual_param); } scope.add (null, generated_delegate); -- cgit v1.2.1