[svn] r6108: nemerle/trunk/ncc: completion/CodeCompletionEngine.n hierarchy/TypesManager.n testsuite/compl...

trupill svnadmin at nemerle.org
Sun Feb 5 09:39:52 CET 2006


Log:
Making code completion work again.
* OverloadPossibility.n: letting out 2 asserts that made completion over 
non-static members not to work
* TypesManager.n: making "infos" variable internal to speed a bit the 
completion
* completion-playground: adding a testcase more to check variable 
completion


Author: trupill
Date: Sun Feb  5 09:39:47 2006
New Revision: 6108

Modified:
   nemerle/trunk/ncc/completion/CodeCompletionEngine.n
   nemerle/trunk/ncc/hierarchy/TypesManager.n
   nemerle/trunk/ncc/testsuite/completion-playground/compl.n
   nemerle/trunk/ncc/typing/OverloadPossibility.n

Modified: nemerle/trunk/ncc/completion/CodeCompletionEngine.n
==============================================================================
--- nemerle/trunk/ncc/completion/CodeCompletionEngine.n	(original)
+++ nemerle/trunk/ncc/completion/CodeCompletionEngine.n	Sun Feb  5 09:39:47 2006
@@ -306,30 +306,26 @@
                 
                 try
                 {
-                    foreach (source in Sources.sources)
+                    def filenames = Sources.sources.Fold ([], fun (k, _, acc) { k :: acc });
+                    
+                    foreach (filename in filenames)
                     {
-                        match (source.Value)
+                        match (Sources.sources [filename])
                         {
                         | NotParsed as np =>
                             mutable contents = np.code;
                             def completionIndex = contents.IndexOf (MagicWord);
                             when (completionIndex > -1)
                             {
-                                fileToComplete = source.Key;
+                                fileToComplete = filename;
                                 offsetToComplete = completionIndex;
                                 contents = contents.Replace (MagicWord, "");
                                 get_line_and_col_from_offset (contents, completionIndex);
                             }
-                            def lexer = LexerString (contents, Location (Location.GetFileIndex (source.Key), 1, 1));
+                            def lexer = LexerString (contents, Location (Location.GetFileIndex (filename), 1, 1));
                             def decls = Passes.ParsingPipeline (lexer);
-                            Sources.sources[source.Key] = ParsedFile.Parsed (decls, contents);
+                            Sources.sources[filename] = ParsedFile.Parsed (decls, contents);
                             trees ::= decls;
-                            def completeIndex = contents.IndexOf (MagicWord);
-                            when (completeIndex > -1)
-                            {
-                                fileToComplete = source.Key;
-                                
-                            }
                         | Parsed as p => trees ::= p.decls;
                         }
                     }
@@ -396,7 +392,7 @@
     
                 mutable observed_method = null;
                 // get the method
-                Passes.Hierarchy.Iter (fun (ti) {
+                Passes.Hierarchy.infos.Iter (fun (ti) {
                     foreach (member in ti.GetDirectMembers ())
                     {
                     | meth is MethodBuilder => 
@@ -430,12 +426,13 @@
                 def body_start = find_line_col (real_contents, 
                     observed_method.BodyLocation.Line, observed_method.BodyLocation.Column);
                 def bracket_location = real_contents.IndexOf ("{", body_start);
-                def my_body = real_contents.Substring (
+                mutable my_body = real_contents.Substring (
                     bracket_location + 1, offsetToComplete - body_start - 1);
                 
-                System.Console.WriteLine (my_body);
+                my_body = my_body.Trim();
     
                 def lexer = LexerCompletion (my_body + " ", my_body.Length);
+                // def lexer = LexerCompletion (element + " ", element.Length);
                 observed_method.GetHeader ().body =
                     FunBody.Parsed (MainParser.ParseExpr (env, lexer));
                 

Modified: nemerle/trunk/ncc/hierarchy/TypesManager.n
==============================================================================
--- nemerle/trunk/ncc/hierarchy/TypesManager.n	(original)
+++ nemerle/trunk/ncc/hierarchy/TypesManager.n	Sun Feb  5 09:39:47 2006
@@ -33,7 +33,7 @@
   /* ---------------------------------------------------------------------- */
   public partial class TypesManager 
   {
-    protected mutable infos : list [TypeBuilder] = [];
+    protected internal mutable infos : list [TypeBuilder] = [];
     internal mutable run_phase : int;
 
     protected attribute_macros_queue : Nemerle.Collections.Heap [AttributeMacroExpansion] = Nemerle.Collections.Heap (100);

Modified: nemerle/trunk/ncc/testsuite/completion-playground/compl.n
==============================================================================
--- nemerle/trunk/ncc/testsuite/completion-playground/compl.n	(original)
+++ nemerle/trunk/ncc/testsuite/completion-playground/compl.n	Sun Feb  5 09:39:47 2006
@@ -74,6 +74,7 @@
 }
 
 def try_completion (body) {
+  System.Console.WriteLine(body);
   def env = my_method.DeclaringType.GlobalEnv;
   def lexer = LexerCompletion (body + " ", body.Length);
   my_method.GetHeader ().body =
@@ -93,3 +94,4 @@
 try_completion ("this.Fo");
 try_completion ("System.Collections.Generic.Q");
 try_completion ("Q");
+try_completion ("def a = \"a\"; a.");

Modified: nemerle/trunk/ncc/typing/OverloadPossibility.n
==============================================================================
--- nemerle/trunk/ncc/typing/OverloadPossibility.n	(original)
+++ nemerle/trunk/ncc/typing/OverloadPossibility.n	Sun Feb  5 09:39:47 2006
@@ -183,11 +183,11 @@
           | _ => {}
         }
 
-      assert ((expr == null) == is_static, 
+      /*assert ((expr == null) == is_static, 
               $ "expr/IsStatic $member $(member.IsStatic) $is_static");
 
       assert ((from == null) != is_static, 
-              $ "from/IsStatic $member $(member.IsStatic) $is_static");
+              $ "from/IsStatic $member $(member.IsStatic) $is_static");*/
 
       this.expr = expr;
       this.from = from;



More information about the svn mailing list