CSharp parser deep class searches [Was: [MonoDevelop]
DefaultParserService: deep class yada yada]
Peter Johanson
latexer at gentoo.org
Thu Jun 16 22:25:20 EDT 2005
On Wed, Jun 15, 2005 at 06:16:33AM -0700, Peter Johanson wrote:
> Hey all,
>
> Currently, if you have a project with a reference to gtk-sharp.dll, and
> you instantiate a Gtk.Window, w, then trying to complete the members of
> "w.GdkWindow" doesn't work (in either C# or Boo bindings, haven't
After talking with Lluis about this, he seemed to think that fixing this
in the various language bindings was better. Attached is a patch that
should do this for the C# resolver, I have an equivalent patch for boo
ready if people like this better. Thoughts?
-pete
--
Peter Johanson
<latexer at gentoo.org>
-------------- next part --------------
Index: Core/src/AddIns/BackendBindings/CSharpBinding/Parser/Resolver.cs
===================================================================
--- Core/src/AddIns/BackendBindings/CSharpBinding/Parser/Resolver.cs (revision 2602)
+++ Core/src/AddIns/BackendBindings/CSharpBinding/Parser/Resolver.cs (working copy)
@@ -169,7 +169,7 @@
return null;
}
IReturnType retType = internalResolve (parserService, expression, caretLineNumber, caretColumn, fileName, fileContent);
- IClass retClass = parserService.SearchType (project, retType.FullyQualifiedName, null, cu);
+ IClass retClass = parserService.GetClass (project, retType.FullyQualifiedName, true, true);
if (retClass == null) {
Console.WriteLine ("Retclass was null");
return null;
@@ -716,7 +716,7 @@
return null;
}
IClass c;
- c = parserService.GetClass(project, name);
+ c = parserService.GetClass(project, name, true, true);
if (c != null) {
// Console.WriteLine("Found!");
return c;
@@ -727,10 +727,15 @@
foreach (IUsing u in unit.Usings) {
if (u != null && (u.Region == null || u.Region.IsInside(caretLine, caretColumn))) {
// Console.WriteLine("In UsingRegion");
- c = parserService.SearchType(project, u, name);
- if (c != null) {
-// Console.WriteLine("SearchType Successfull!!!");
- return c;
+ foreach (string str in u.Usings)
+ {
+ string possibleType = String.Concat(str, ".", name);
+
+ c = parserService.GetClass(project, possibleType, true, true);
+ if (c != null) {
+ // Console.WriteLine("SearchType Successfull!!!");
+ return c;
+ }
}
}
}
@@ -745,7 +750,7 @@
do {
curnamespace += namespaces[i] + '.';
- c = parserService.GetClass(project, curnamespace + name);
+ c = parserService.GetClass(project, curnamespace + name, true, true);
if (c != null) {
return c;
}
Index: Core/src/AddIns/BackendBindings/CSharpBinding/ChangeLog
===================================================================
--- Core/src/AddIns/BackendBindings/CSharpBinding/ChangeLog (revision 2602)
+++ Core/src/AddIns/BackendBindings/CSharpBinding/ChangeLog (working copy)
@@ -1,3 +1,8 @@
+2005-05-16 Peter Johanson <latexer at gentoo.org>
+
+ * Parser/Resolver.cs: Make searches for classes deep searches, to
+ resolve types from assemblies referened by project references.
+
2005-05-15 Lluis Sanchez Gual <lluis at novell.com>
* CSharp.glade: Several fixes to make the dialogs more conforming
More information about the Monodevelop-list
mailing list