[vala] Support static methods in generic classes
- From: JÃrg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] Support static methods in generic classes
- Date: Tue, 14 Aug 2012 12:14:33 +0000 (UTC)
commit dc692a038403503e43abbb6c7140332b4f274ca1
Author: JÃrg Billeter <j bitron ch>
Date: Tue Aug 14 14:12:58 2012 +0200
Support static methods in generic classes
vala/valamemberaccess.vala | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala
index de970b8..af9f51f 100644
--- a/vala/valamemberaccess.vala
+++ b/vala/valamemberaccess.vala
@@ -799,6 +799,18 @@ public class Vala.MemberAccess : Expression {
Report.error (source_reference, "Access to instance member `%s' from nullable reference denied".printf (symbol_reference.get_full_name ()));
}
+ var m = symbol_reference as Method;
+ var inner_ma = inner as MemberAccess;
+ if (m != null && m.binding == MemberBinding.STATIC && m.parent_symbol is ObjectTypeSymbol &&
+ inner != null && inner.value_type == null && inner_ma.type_argument_list.size > 0) {
+ // support static methods in generic classes
+ inner.value_type = new ObjectType ((ObjectTypeSymbol) m.parent_symbol);
+
+ foreach (var type_argument in inner_ma.type_argument_list) {
+ inner.value_type.add_type_argument (type_argument);
+ }
+ }
+
formal_value_type = context.analyzer.get_value_type_for_symbol (symbol_reference, lvalue);
if (inner != null && formal_value_type != null) {
value_type = formal_value_type.get_actual_type (inner.value_type, null, this);
@@ -807,8 +819,6 @@ public class Vala.MemberAccess : Expression {
}
if (symbol_reference is Method) {
- var m = (Method) symbol_reference;
-
if (target_type != null) {
value_type.value_owned = target_type.value_owned;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]