[svn] r6383: nemerle/trunk/ncc: completion/CodeCompletionEngine.n external/LibrariesLoader.n typing/Typer....

nazgul svnadmin at nemerle.org
Thu Jun 8 20:09:17 CEST 2006


Log:
Make extension methods appear in completion engine

Author: nazgul
Date: Thu Jun  8 20:09:15 2006
New Revision: 6383

Modified:
   nemerle/trunk/ncc/completion/CodeCompletionEngine.n
   nemerle/trunk/ncc/external/LibrariesLoader.n
   nemerle/trunk/ncc/typing/Typer.n

Modified: nemerle/trunk/ncc/completion/CodeCompletionEngine.n
==============================================================================
--- nemerle/trunk/ncc/completion/CodeCompletionEngine.n	(original)
+++ nemerle/trunk/ncc/completion/CodeCompletionEngine.n	Thu Jun  8 20:09:15 2006
@@ -496,7 +496,7 @@
                 name
                 
             | TyVarRef as r => r.tyvar.Name
-            | Fun as f => GetNameFromType (f.from :> MType) + " -> " + GetNameFromType (f.to :> MType)
+            | Fun as f => GetNameFromType (f.from.Fix ()) + " -> " + GetNameFromType (f.to.Fix ())
             | Tuple as tuple => mutable name = "(";
                 foreach (tx in tuple.args)
                 {
@@ -505,10 +505,10 @@
                 }
                 name = name.Trim(',', ' ') + ")";
                 name
-            | Array as a => "array[" + GetNameFromType (a.t :> MType) + "]"
+            | Array as a => "array[" + GetNameFromType (a.t.Fix ()) + "]"
             | Void => "void"
-            | Ref as rf => "ref " + GetNameFromType (rf.t :> MType)
-            | Out as ut => "out " + GetNameFromType (ut.t :> MType)
+            | Ref as rf => "ref " + GetNameFromType (rf.t.Fix ())
+            | Out as ut => "out " + GetNameFromType (ut.t.Fix ())
             | _ => ""
          }
                 

Modified: nemerle/trunk/ncc/external/LibrariesLoader.n
==============================================================================
--- nemerle/trunk/ncc/external/LibrariesLoader.n	(original)
+++ nemerle/trunk/ncc/external/LibrariesLoader.n	Thu Jun  8 20:09:15 2006
@@ -144,8 +144,16 @@
       }
     }
       
-    public GetExtensionMethods (name : string, env : GlobalEnv) : list [IMethod]
+    public GetExtensionMethods (name : string, env : GlobalEnv, for_completion : bool) : list [IMethod]
     {
+      if (for_completion) {
+        mutable acc = [];
+        foreach (ex in _extension_methods.Keys)
+          when (ex.StartsWith (name))
+            acc += GetExtensionMethods (ex, env, false);
+        acc
+      }
+      else
       if (_extension_methods.Contains (name))
         _extension_methods [name].FoldLeft ([], fun (meth, acc) {
           if (env.IsOpenNamespace (meth.DeclaringType.NamespaceNode.Parent))

Modified: nemerle/trunk/ncc/typing/Typer.n
==============================================================================
--- nemerle/trunk/ncc/typing/Typer.n	(original)
+++ nemerle/trunk/ncc/typing/Typer.n	Thu Jun  8 20:09:15 2006
@@ -2353,7 +2353,7 @@
           lookup (possible_type);
         }
 
-        foreach (meth in Manager.LibrariesManager.GetExtensionMethods (name.Id, name.GetEnv (env)))
+        foreach (meth in Manager.LibrariesManager.GetExtensionMethods (name.Id, name.GetEnv (env), for_completion))
           foreach (over in ConstructMethodOverload (meth, maybe_varargs = true)) {
             over.ExtensionMethodObject = obj;
             res ::= over;



More information about the svn mailing list