]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Fix generic type resolution for arrays of generic types
authorLuca Bruno <lethalman88@gmail.com>
Sun, 24 Jan 2010 00:27:42 +0000 (01:27 +0100)
committerJürg Billeter <j@bitron.ch>
Fri, 29 Jan 2010 12:56:28 +0000 (13:56 +0100)
Arrays of generic types are still only supported for pointer-based
element types.

Fixes bug 568972.

vala/valaarraytype.vala
vala/valadatatype.vala

index 63028cbbdf7ca67f0fd0fc0ed492bfacace52c7a..da81400b74fa30fca954bca6db52764fb4264f75 100644 (file)
@@ -247,4 +247,20 @@ public class Vala.ArrayType : ReferenceType {
                        return null;
                }
        }
+
+       public override DataType get_actual_type (DataType? derived_instance_type, MemberAccess? method_access, CodeNode node_reference) {
+               if (derived_instance_type == null && method_access == null) {
+                       return this;
+               }
+
+               ArrayType result = this;
+
+               if (element_type is GenericType || element_type.has_type_arguments ()) {
+                       result = (ArrayType) result.copy ();
+                       result.element_type = result.element_type.get_actual_type (derived_instance_type, method_access, node_reference);
+               }
+
+               return result;
+       }
+
 }
index b8b6cebab2b134490376b77fd18c7a2971ecf622..7e6cb64c425292511117ba12cf27bd58be329d33 100644 (file)
@@ -90,6 +90,14 @@ public abstract class Vala.DataType : CodeNode {
                return _empty_type_list;
        }
 
+       public bool has_type_arguments () {
+               if (type_argument_list == null) {
+                       return false;
+               }
+
+               return type_argument_list.size > 0;
+       }
+
        /**
         * Removes all generic type arguments.
         */
@@ -507,7 +515,7 @@ public abstract class Vala.DataType : CodeNode {
                return false;
        }
 
-       public DataType get_actual_type (DataType? derived_instance_type, MemberAccess? method_access, CodeNode node_reference) {
+       public virtual DataType get_actual_type (DataType? derived_instance_type, MemberAccess? method_access, CodeNode node_reference) {
                if (derived_instance_type == null && method_access == null) {
                        return this;
                }