[vala] Fix type resolution with derived integer types



commit 5e7562115e3f186ce643c45d9b14c09782d63ad5
Author: Jürg Billeter <j bitron ch>
Date:   Fri Jan 8 17:51:43 2010 +0100

    Fix type resolution with derived integer types

 vala/valasymbolresolver.vala |   29 ++++++++++++++++++-----------
 1 files changed, 18 insertions(+), 11 deletions(-)
---
diff --git a/vala/valasymbolresolver.vala b/vala/valasymbolresolver.vala
index 6b94e12..6c70dbe 100644
--- a/vala/valasymbolresolver.vala
+++ b/vala/valasymbolresolver.vala
@@ -255,6 +255,23 @@ public class Vala.SymbolResolver : CodeVisitor {
 		}
 	}
 
+	DataType get_type_for_struct (Struct st, Struct base_struct) {
+		if (base_struct.base_struct != null) {
+			return get_type_for_struct (st, base_struct.base_struct);
+		}
+
+		// attributes are not processed yet, access them directly
+		if (base_struct.get_attribute ("BooleanType") != null) {
+			return new BooleanType (st);
+		} else if (base_struct.get_attribute ("IntegerType") != null) {
+			return new IntegerType (st);
+		} else if (base_struct.get_attribute ("FloatingType") != null) {
+			return new FloatingType (st);
+		} else {
+			return new StructValueType (st);
+		}
+	}
+
 	private DataType resolve_type (UnresolvedType unresolved_type) {
 		DataType type = null;
 
@@ -287,17 +304,7 @@ public class Vala.SymbolResolver : CodeVisitor {
 			} else if (sym is Interface) {
 				type = new ObjectType ((Interface) sym);
 			} else if (sym is Struct) {
-				var st = (Struct) sym;
-				// attributes are not processed yet, access them directly
-				if (st.get_attribute ("BooleanType") != null) {
-					type = new BooleanType (st);
-				} else if (st.get_attribute ("IntegerType") != null) {
-					type = new IntegerType (st);
-				} else if (st.get_attribute ("FloatingType") != null) {
-					type = new FloatingType (st);
-				} else {
-					type = new StructValueType (st);
-				}
+				type = get_type_for_struct ((Struct) sym, (Struct) sym);
 			} else if (sym is Enum) {
 				type = new EnumValueType ((Enum) sym);
 			} else if (sym is ErrorDomain) {



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