[svn] r6572: nemerle/trunk/ncc: completion/CodeCompletionEngine.n typing/TyVarEnv.n

VladD2 svnadmin at nemerle.org
Wed Aug 23 19:43:16 CEST 2006


Log:
Add completion in type cast.

Author: VladD2
Date: Wed Aug 23 19:43:11 2006
New Revision: 6572

Modified:
   nemerle/trunk/ncc/completion/CodeCompletionEngine.n
   nemerle/trunk/ncc/typing/TyVarEnv.n

Modified: nemerle/trunk/ncc/completion/CodeCompletionEngine.n
==============================================================================
--- nemerle/trunk/ncc/completion/CodeCompletionEngine.n	(original)
+++ nemerle/trunk/ncc/completion/CodeCompletionEngine.n	Wed Aug 23 19:43:11 2006
@@ -84,12 +84,21 @@
             }
           }
         
-        match (subNode.Value)
+        subNode.EnsureCached ();
+
+        def scanStaticMembers (ti)
         {
-          | Cached(ti) => //Nemerle.Compiler.NamespaceTree.TypeInfoCache.Cached
             foreach (member in ti.GetMembers (BindingFlags.Public | BindingFlags.Static))
               when (isAll || member.GetName().StartsWith(prefix, CmpOptins))
                 elems.Add(Elem.Member (member));
+        }
+
+        match (subNode.Value)
+        {
+          | Cached(ti)                 => scanStaticMembers (ti)
+          | CachedAmbiguous(typeInfos) =>
+            foreach (ti in typeInfos)
+              scanStaticMembers (ti);
 
           | _ => ()
         }

Modified: nemerle/trunk/ncc/typing/TyVarEnv.n
==============================================================================
--- nemerle/trunk/ncc/typing/TyVarEnv.n	(original)
+++ nemerle/trunk/ncc/typing/TyVarEnv.n	Wed Aug 23 19:43:11 2006
@@ -34,6 +34,7 @@
 using Nemerle.Compiler.SolverMacros;
 using System;
 using System.Reflection;
+using SCG = System.Collections.Generic;
 
 namespace Nemerle.Compiler
 {
@@ -244,6 +245,18 @@
         f2 (t, false)
       } and f2 (t, allow_ref) {
         match (t) {
+          | PExpr.ToComplete (name) with obj = null
+          | PExpr.Member (obj, Parsetree.Splicable.HalfId (name)) =>
+            def obj = obj;
+            def name = name;
+            def elems = SCG.List ();
+
+            def nss = Manager.CoreEnv.NameTree.NamespaceTree 
+              :: name.GetEnv(Manager.CoreEnv).OpenNamespaces;
+            Completion.AddTypesAndNamespaces (elems, nss, obj, name, true);
+
+            throw CompletionResult (elems, name.Id);
+
           | <[ ref $t ]> when allow_ref =>
             MType.Ref (f (t))
           



More information about the svn mailing list