]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
dova: Use Dova.Array as type of arrays
authorJürg Billeter <j@bitron.ch>
Sat, 5 Jun 2010 07:44:40 +0000 (09:44 +0200)
committerJürg Billeter <j@bitron.ch>
Sat, 5 Jun 2010 08:12:10 +0000 (10:12 +0200)
vala/valaarraytype.vala
vala/valasemanticanalyzer.vala

index 9561a610a90f080e29f2960b9c3ae68296845c74..be626f59d68503d6874b9b3fbee29fbf4d03df5f 100644 (file)
@@ -66,7 +66,9 @@ public class Vala.ArrayType : ReferenceType {
        }
 
        public override Symbol? get_member (string member_name) {
-               if (member_name == "length") {
+               if (CodeContext.get ().profile == Profile.DOVA) {
+                       return SemanticAnalyzer.symbol_lookup_inherited (CodeContext.get ().root.scope.lookup ("Dova").scope.lookup ("Array"), member_name);
+               } else if (member_name == "length") {
                        return get_length_field ();
                } else if (member_name == "move") {
                        return get_move_method ();
@@ -152,7 +154,11 @@ public class Vala.ArrayType : ReferenceType {
                if (inline_allocated) {
                        return element_type.get_cname ();
                } else {
-                       return element_type.get_cname () + "*";
+                       if (CodeContext.get ().profile == Profile.DOVA) {
+                               return "DovaArray*";
+                       } else {
+                               return element_type.get_cname () + "*";
+                       }
                }
        }
 
index 5e7754d32ca17b5b7e43d4dff09a6450844c5667..49817386bed3e59e733b73ffec22811c0a660740 100644 (file)
@@ -603,6 +603,14 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
                        instance_type = instance_pointer_type.base_type;
                }
 
+               if (CodeContext.get ().profile == Profile.DOVA) {
+                       while (instance_type is ArrayType) {
+                               var instance_array_type = (ArrayType) instance_type;
+                               instance_type = new ObjectType ((Class) CodeContext.get ().root.scope.lookup ("Dova").scope.lookup ("Array"));
+                               instance_type.add_type_argument (instance_array_type.element_type);
+                       }
+               }
+
                if (instance_type.data_type == type_symbol) {
                        return instance_type;
                }