[Monodevelop-patches-list] r1668 - in trunk/MonoDevelop/src/AddIns/BackendBindings/CSharpBinding: . Parser

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Sun May 30 14:20:09 EDT 2004


Author: lluis
Date: 2004-05-30 14:20:09 -0400 (Sun, 30 May 2004)
New Revision: 1668

Modified:
   trunk/MonoDevelop/src/AddIns/BackendBindings/CSharpBinding/ChangeLog
   trunk/MonoDevelop/src/AddIns/BackendBindings/CSharpBinding/Parser/Resolver.cs
Log:
	* Parser/Resolver.cs: Resolve base classes using a deep search in all
	  project references. In SearchType, fixed namespace lookup so it works
	  for inner classes as well.


Modified: trunk/MonoDevelop/src/AddIns/BackendBindings/CSharpBinding/ChangeLog
===================================================================
--- trunk/MonoDevelop/src/AddIns/BackendBindings/CSharpBinding/ChangeLog	2004-05-30 18:19:41 UTC (rev 1667)
+++ trunk/MonoDevelop/src/AddIns/BackendBindings/CSharpBinding/ChangeLog	2004-05-30 18:20:09 UTC (rev 1668)
@@ -1,3 +1,9 @@
+2004-05-30  Lluis Sanchez Gual  <lluis at ximian.com>
+
+	* Parser/Resolver.cs: Resolve base classes using a deep search in all
+	  project references. In SearchType, fixed namespace lookup so it works
+	  for inner classes as well.
+
 2004-05-27  Todd Berman  <tberman at sevenl.net>
 
 	* CSharpBindingCompilerManager.cs: fix up projects with space in

Modified: trunk/MonoDevelop/src/AddIns/BackendBindings/CSharpBinding/Parser/Resolver.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/BackendBindings/CSharpBinding/Parser/Resolver.cs	2004-05-30 18:19:41 UTC (rev 1667)
+++ trunk/MonoDevelop/src/AddIns/BackendBindings/CSharpBinding/Parser/Resolver.cs	2004-05-30 18:20:09 UTC (rev 1668)
@@ -297,7 +297,7 @@
 //			Console.WriteLine("ClassType = " + curType.ClassType);
 			if (curType.ClassType == ClassType.Interface && !showStatic) {
 				foreach (string s in curType.BaseTypes) {
-					IClass baseClass = SearchType(s, curType.CompilationUnit);
+					IClass baseClass = parserService.GetClass (project, s, true, true);
 					if (baseClass != null && baseClass.ClassType == ClassType.Interface) {
 						ListMembers(members, baseClass);
 					}
@@ -316,7 +316,7 @@
 		public IClass BaseClass(IClass curClass)
 		{
 			foreach (string s in curClass.BaseTypes) {
-				IClass baseClass = SearchType(s, curClass.CompilationUnit);
+				IClass baseClass = parserService.GetClass (project, s, true, true);
 				if (baseClass != null && baseClass.ClassType != ClassType.Interface) {
 					return baseClass;
 				}
@@ -484,7 +484,7 @@
 				}
 			}
 			foreach (string baseType in curType.BaseTypes) {
-				IClass c = SearchType(baseType, curType.CompilationUnit);
+				IClass c = parserService.GetClass (project, baseType, true, true);
 				if (c != null) {
 					IReturnType erg = SearchMember(new ReturnType(c.FullyQualifiedName), memberName);
 					if (erg != null) {
@@ -707,15 +707,15 @@
 		/// </remarks>
 		public IClass SearchType(string name, ICompilationUnit unit)
 		{
-			Console.WriteLine("Searching Type " + name);
+//			Console.WriteLine("Searching Type " + name);
 			if (name == null || name == String.Empty) {
-				Console.WriteLine("No Name!");
+//				Console.WriteLine("No Name!");
 				return null;
 			}
 			IClass c;
 			c = parserService.GetClass(project, name);
 			if (c != null) {
-				Console.WriteLine("Found!");
+//				Console.WriteLine("Found!");
 				return c;
 			}
 			Console.WriteLine("No FullName");
@@ -723,10 +723,10 @@
 				Console.WriteLine(unit.Usings.Count + " Usings");
 				foreach (IUsing u in unit.Usings) {
 					if (u != null && (u.Region == null || u.Region.IsInside(caretLine, caretColumn))) {
-						Console.WriteLine("In UsingRegion");
+//						Console.WriteLine("In UsingRegion");
 						c = parserService.SearchType(project, u, name);
 						if (c != null) {
-							Console.WriteLine("SearchType Successfull!!!");
+//							Console.WriteLine("SearchType Successfull!!!");
 							return c;
 						}
 					}
@@ -737,14 +737,19 @@
 			}
 			string fullname = callingClass.FullyQualifiedName;
 			string[] namespaces = fullname.Split(new char[] {'.'});
-			string curnamespace = namespaces[0] + '.';
-			for (int i = 1; i < namespaces.Length; ++i) {
+			string curnamespace = "";
+			int i = 0;
+			
+			do {
+				curnamespace += namespaces[i] + '.';
 				c = parserService.GetClass(project, curnamespace + name);
 				if (c != null) {
 					return c;
 				}
-				curnamespace += namespaces[i] + '.';
+				i++;
 			}
+			while (i < namespaces.Length);
+			
 			return null;
 		}
 		
@@ -760,7 +765,8 @@
 				return true;
 			}
 			foreach (string baseClass in c.BaseTypes) {
-				if (IsClassInInheritanceTree(possibleBaseClass, SearchType(baseClass, cu))) {
+				IClass bc = parserService.GetClass (project, baseClass, true, true);
+				if (IsClassInInheritanceTree(possibleBaseClass, bc)) {
 					return true;
 				}
 			}
@@ -882,7 +888,8 @@
 			if (type.ArrayDimensions != null && type.ArrayDimensions.Length > 0)
 				type = new ReturnType ("System.Array");
 
-			IClass returnClass = parserService.SearchType (project, type.FullyQualifiedName, null, cu);
+			IClass returnClass = SearchType (type.FullyQualifiedName, cu);
+//			IClass returnClass = parserService.SearchType (project, type.FullyQualifiedName, null, cu);
 			if (returnClass == null)
 				return null;
 




More information about the Monodevelop-patches-list mailing list