[vala] dova: Use Dova.Array as type of arrays



commit 6b85afc727cd385f6ebfb67677579011f9cd4457
Author: Jürg Billeter <j bitron ch>
Date:   Sat Jun 5 09:44:40 2010 +0200

    dova: Use Dova.Array as type of arrays

 vala/valaarraytype.vala        |   10 ++++++++--
 vala/valasemanticanalyzer.vala |    8 ++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/vala/valaarraytype.vala b/vala/valaarraytype.vala
index 9561a61..be626f5 100644
--- a/vala/valaarraytype.vala
+++ b/vala/valaarraytype.vala
@@ -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 () + "*";
+			}
 		}
 	}
 
diff --git a/vala/valasemanticanalyzer.vala b/vala/valasemanticanalyzer.vala
index 5e7754d..4981738 100644
--- a/vala/valasemanticanalyzer.vala
+++ b/vala/valasemanticanalyzer.vala
@@ -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;
 		}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]