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



commit dde68eec99063198254938b85ea2ee40fa6995a4
Author: Florian Brosch <flo brosch gmail com>
Date:   Fri Aug 12 23:16:55 2011 +0200

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

 src/driver/0.12.x/symbolresolver.vala |    4 +--
 src/driver/0.12.x/treebuilder.vala    |   46 +++++++++++++++++---------------
 2 files changed, 25 insertions(+), 25 deletions(-)
---
diff --git a/src/driver/0.12.x/symbolresolver.vala b/src/driver/0.12.x/symbolresolver.vala
index ebc6d66..ad47b3b 100644
--- a/src/driver/0.12.x/symbolresolver.vala
+++ b/src/driver/0.12.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.12.x/treebuilder.vala b/src/driver/0.12.x/treebuilder.vala
index 8ad2b9a..d64c2c9 100644
--- a/src/driver/0.12.x/treebuilder.vala
+++ b/src/driver/0.12.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, Symbol 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, Symbol 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, Symbol 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);
 			}
 		}
@@ -689,7 +691,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);
@@ -720,7 +722,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 {
@@ -748,7 +750,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_children (node, element);
@@ -763,7 +765,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, element.get_cname (), 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);
 
@@ -779,7 +781,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, element.nick, 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);
 
@@ -806,7 +808,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, element.get_cname (), Vala.GDBusModule.get_dbus_name_for_member (element), Vala.GDBusServerModule.dbus_result_name (element), (element.coroutine)? element.get_finish_cname () : 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);
 
@@ -822,7 +824,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, element.get_cname (), Vala.GDBusModule.get_dbus_name_for_member (element), Vala.GDBusServerModule.dbus_result_name (element), (element.coroutine)? element.get_finish_cname () : 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);
 
@@ -838,7 +840,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, element.get_cname(), 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);
 
@@ -854,7 +856,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, element.get_cname (), 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);
 
@@ -900,7 +902,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, element.get_cname (), 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);
 
@@ -958,7 +960,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]