[valadoc] driver/0.13.x: Fix type parameter creation for methods and implemented interfaces



commit f9ce15617446918b07090e95895feb09624addc2
Author: Florian Brosch <flo brosch gmail com>
Date:   Fri Aug 12 17:15:47 2011 +0200

    driver/0.13.x: Fix type parameter creation for methods and implemented interfaces

 src/driver/0.13.x/symbolresolver.vala |    4 +--
 src/driver/0.13.x/treebuilder.vala    |   46 +++++++++++++++++---------------
 2 files changed, 25 insertions(+), 25 deletions(-)
---
diff --git a/src/driver/0.13.x/symbolresolver.vala b/src/driver/0.13.x/symbolresolver.vala
index ebc6d66..ad47b3b 100644
--- a/src/driver/0.13.x/symbolresolver.vala
+++ b/src/driver/0.13.x/symbolresolver.vala
@@ -66,9 +66,7 @@ public class Valadoc.Drivers.SymbolResolver : Visitor {
 
 	private void resolve_type_reference (TypeReference reference) {
 		Vala.DataType vtyperef = (Vala.DataType) reference.data;
-		if (vtyperef is Vala.GenericType) {
-			 reference.data_type = resolve (((Vala.GenericType) vtyperef).type_parameter);
-		} else if (vtyperef is Vala.ErrorType) {
+		if (vtyperef is Vala.ErrorType) {
 			Vala.ErrorDomain verrdom = ((Vala.ErrorType) vtyperef).error_domain;
 			if (verrdom != null) {
 				reference.data_type = resolve (verrdom);
diff --git a/src/driver/0.13.x/treebuilder.vala b/src/driver/0.13.x/treebuilder.vala
index 8b309e1..5aa069e 100644
--- a/src/driver/0.13.x/treebuilder.vala
+++ b/src/driver/0.13.x/treebuilder.vala
@@ -122,35 +122,35 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 	// Type constructor translation helpers:
 	//
 
-	private Pointer create_pointer (Vala.PointerType vtyperef, Item parent) {
+	private Pointer create_pointer (Vala.PointerType vtyperef, Item parent, Api.Node caller) {
 		Pointer ptr = new Pointer (parent, vtyperef);
 
 		Vala.DataType vntype = vtyperef.base_type;
 		if (vntype is Vala.PointerType) {
-			ptr.data_type = create_pointer ((Vala.PointerType) vntype, ptr);
+			ptr.data_type = create_pointer ((Vala.PointerType) vntype, ptr, caller);
 		} else if (vntype is Vala.ArrayType) {
-			ptr.data_type = create_array ((Vala.ArrayType) vntype, ptr);
+			ptr.data_type = create_array ((Vala.ArrayType) vntype, ptr, caller);
 		} else {
-			ptr.data_type = create_type_reference (vntype, ptr);
+			ptr.data_type = create_type_reference (vntype, ptr, caller);
 		}
 
 		return ptr;
 	}
 
-	private Api.Array create_array (Vala.ArrayType vtyperef, Item parent) {
+	private Api.Array create_array (Vala.ArrayType vtyperef, Item parent, Api.Node caller) {
 		Api.Array arr = new Api.Array (parent, vtyperef);
 
 		Vala.DataType vntype = vtyperef.element_type;
 		if (vntype is Vala.ArrayType) {
-			arr.data_type = create_array ((Vala.ArrayType) vntype, arr);
+			arr.data_type = create_array ((Vala.ArrayType) vntype, arr, caller);
 		} else {
-			arr.data_type = create_type_reference (vntype, arr);
+			arr.data_type = create_type_reference (vntype, arr, caller);
 		}
 
 		return arr;
 	}
 
-	private TypeReference create_type_reference (Vala.DataType? vtyperef, Item parent) {
+	private TypeReference create_type_reference (Vala.DataType? vtyperef, Item parent, Api.Node caller) {
 		bool is_nullable = vtyperef != null && vtyperef.nullable && !(vtyperef is Vala.GenericType) && !(vtyperef is Vala.PointerType);
 		string? signature = (vtyperef != null && vtyperef.data_type != null)? Vala.GVariantModule.get_dbus_signature (vtyperef.data_type) : null;
 		bool pass_ownership = type_reference_pass_ownership (vtyperef);
@@ -160,15 +160,17 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 		TypeReference type_ref = new TypeReference (parent, ownership, pass_ownership, is_dynamic, is_nullable, signature, vtyperef);
 
 		if (vtyperef is Vala.PointerType) {
-			type_ref.data_type = create_pointer ((Vala.PointerType) vtyperef,  type_ref);
+			type_ref.data_type = create_pointer ((Vala.PointerType) vtyperef,  type_ref, caller);
 		} else if (vtyperef is Vala.ArrayType) {
-			type_ref.data_type = create_array ((Vala.ArrayType) vtyperef,  type_ref);
+			type_ref.data_type = create_array ((Vala.ArrayType) vtyperef,  type_ref, caller);
+		} else if (vtyperef is Vala.GenericType) {
+			type_ref.data_type = new TypeParameter (caller, caller.get_source_file (), ((Vala.GenericType) vtyperef).type_parameter.name, vtyperef);
 		}
 
 		// type parameters:
 		if (vtyperef != null) {
 			foreach (Vala.DataType vdtype in vtyperef.get_type_arguments ()) {
-				var type_param = create_type_reference (vdtype, type_ref);
+				var type_param = create_type_reference (vdtype, type_ref, caller);
 				type_ref.add_type_argument (type_param);
 			}
 		}
@@ -857,7 +859,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 
 		// relations
 		foreach (Vala.DataType vala_type_ref in element.get_base_types ()) {
-			var type_ref = create_type_reference (vala_type_ref, node);
+			var type_ref = create_type_reference (vala_type_ref, node, node);
 
 			if (vala_type_ref.data_type is Vala.Interface) {
 				node.add_interface (type_ref);
@@ -889,7 +891,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 
 		// prerequisites:
 		foreach (Vala.DataType vala_type_ref in element.get_prerequisites ()) {
-			TypeReference type_ref = create_type_reference (vala_type_ref, node);
+			TypeReference type_ref = create_type_reference (vala_type_ref, node, node);
 			if (vala_type_ref.data_type is Vala.Interface) {
 				node.add_interface (type_ref);
 			} else {
@@ -918,7 +920,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 		// parent type:
 		Vala.ValueType? basetype = element.base_type as Vala.ValueType;
 		if (basetype != null) {
-			node.base_type = create_type_reference (basetype, node);
+			node.base_type = create_type_reference (basetype, node, node);
 		}
 
 		process_attributes (node, element.attributes);
@@ -934,7 +936,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 		SourceComment? comment = create_comment (element.comment);
 
 		Field node = new Field (parent, file, element.name, get_access_modifier(element), comment, get_cname (element), element.binding == Vala.MemberBinding.STATIC, element.is_volatile, element);
-		node.field_type = create_type_reference (element.variable_type, node);
+		node.field_type = create_type_reference (element.variable_type, node, node);
 		symbol_map.set (element, node);
 		parent.add_child (node);
 
@@ -951,7 +953,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 		SourceComment? comment = create_comment (element.comment);
 
 		Property node = new Property (parent, file, element.name, get_access_modifier(element), comment, get_nick (element), Vala.GDBusModule.get_dbus_name_for_member (element), Vala.GDBusServerModule.is_dbus_visible (element), get_property_binding_type (element), element);
-		node.property_type = create_type_reference (element.property_type, node);
+		node.property_type = create_type_reference (element.property_type, node, node);
 		symbol_map.set (element, node);
 		parent.add_child (node);
 
@@ -979,7 +981,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 		SourceComment? comment = create_comment (element.comment);
 
 		Method node = new Method (parent, file, get_method_name (element), get_access_modifier(element), comment, get_cname (element), Vala.GDBusModule.get_dbus_name_for_member (element), Vala.GDBusServerModule.dbus_result_name (element), (element.coroutine)? get_finish_name (element) : null, get_method_binding_type (element), element.coroutine, Vala.GDBusServerModule.is_dbus_visible (element), element is Vala.CreationMethod, element);
-		node.return_type = create_type_reference (element.return_type, node);
+		node.return_type = create_type_reference (element.return_type, node, node);
 		symbol_map.set (element, node);
 		parent.add_child (node);
 
@@ -996,7 +998,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 		SourceComment? comment = create_comment (element.comment);
 
 		Method node = new Method (parent, file, get_method_name (element), get_access_modifier(element), comment, get_cname (element), Vala.GDBusModule.get_dbus_name_for_member (element), Vala.GDBusServerModule.dbus_result_name (element), (element.coroutine)? get_finish_name (element) : null, get_method_binding_type (element), element.coroutine, Vala.GDBusServerModule.is_dbus_visible (element), element is Vala.CreationMethod, element);
-		node.return_type = create_type_reference (element.return_type, node);
+		node.return_type = create_type_reference (element.return_type, node, node);
 		symbol_map.set (element, node);
 		parent.add_child (node);
 
@@ -1013,7 +1015,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 		SourceComment? comment = create_comment (element.comment);
 
 		Api.Signal node = new Api.Signal (parent, file, element.name, get_access_modifier(element), comment, get_cname (element), Vala.GDBusModule.get_dbus_name_for_member (element), Vala.GDBusServerModule.is_dbus_visible (element), element.is_virtual, element);
-		node.return_type = create_type_reference (element.return_type, node);
+		node.return_type = create_type_reference (element.return_type, node, node);
 		symbol_map.set (element, node);
 		parent.add_child (node);
 
@@ -1030,7 +1032,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 		SourceComment? comment = create_comment (element.comment);
 
 		Delegate node = new Delegate (parent, file, element.name, get_access_modifier(element), comment, get_cname (element), element.has_target, element);
-		node.return_type = create_type_reference (element.return_type, node);
+		node.return_type = create_type_reference (element.return_type, node, node);
 		symbol_map.set (element, node);
 		parent.add_child (node);
 
@@ -1079,7 +1081,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 		SourceComment? comment = create_comment (element.comment);
 
 		Constant node = new Constant (parent, file, element.name, get_access_modifier(element), comment, get_cname (element), element);
-		node.constant_type = create_type_reference (element.type_reference, node);
+		node.constant_type = create_type_reference (element.type_reference, node, node);
 		symbol_map.set (element, node);
 		parent.add_child (node);
 
@@ -1140,7 +1142,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 		SourceFile? file = get_source_file (element);
 
 		FormalParameter node = new FormalParameter (parent, file, element.name, get_access_modifier(element), get_formal_parameter_type (element), element.ellipsis, element);
-		node.parameter_type = create_type_reference (element.variable_type, node);
+		node.parameter_type = create_type_reference (element.variable_type, node, node);
 		parent.add_child (node);
 
 		process_children (node, element);



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