[svn] r6736: vs-plugin/trunk: Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.n Nemerle.VsInt...

IT svnadmin at nemerle.org
Thu Sep 28 06:22:34 CEST 2006


Log:
Inner using regions.

Author: IT
Date: Thu Sep 28 06:22:30 2006
New Revision: 6736

Modified:
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.n
   vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/SourceTextManager.cs

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.n	Thu Sep 28 06:22:30 2006
@@ -173,6 +173,14 @@
 
       def fileIndex = _compileUnits.GetFileIndex(fileName);
 
+      def isNext(line, col, ch)
+      {
+        def str = source.GetLine(line);
+        col > 0 && str.Length >= col && str[col - 1] == ch
+      }
+
+      def processDecls(decls)
+      {
       mutable afterUsingLine = int.MaxValue;
 
       def checkLine(line)
@@ -181,12 +189,6 @@
           afterUsingLine = line;
       }
 
-      def isNext(line, col, ch)
-      {
-        def str = source.GetLine(line);
-        col > 0 && str.Length >= col && str[col - 1] == ch
-      }
-
       def processBuilder(builder)
       {
         // Region for the type itself.
@@ -214,10 +216,10 @@
         // in processed file only!
         | method is MethodBuilder when method.Location.FileIndex == fileIndex =>
 
-#if !DEBUG
+  #if !DEBUG
           when (_start > Environment.TickCount - 2000)
           {
-#endif
+  #endif
             // Get errors.
             //
             def location = method.BodyLocation;
@@ -227,9 +229,9 @@
 
             foreach (cm in _engine.CompilerMessages)
               addError(cm);
-#if !DEBUG
+  #if !DEBUG
           }
-#endif
+  #endif
 
           // Get the method region location.
           //
@@ -257,7 +259,7 @@
 
       def namespaces = List();
 
-      def processDecl(decl)
+        foreach (decl in decls)
       {
       | Decl.Type(builder) when builder.Location.FileIndex == fileIndex =>
 
@@ -269,7 +271,7 @@
 
       | Namespace(decls, _, locations, _, _, nsloc) =>
 
-        decls.Iter(processDecl);
+          processDecls(decls);
 
         match (locations.Find(l => l.FileIndex == fileIndex))
         {
@@ -288,13 +290,9 @@
 
         | None => ()
         }
-
       | _ => ()
       }
 
-      foreach (decl in _compileUnits[fileIndex].Decls)
-        processDecl(decl);
-
       when (namespaces.Count > 1)
       {
         mutable usingLoc;
@@ -346,6 +344,9 @@
       }
     }
 
+      processDecls(_compileUnits[fileIndex].Decls);
+    }
+
     public GetMethodTip(
       [NotNull] filePath : string,
                 line     : int,

Modified: vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/SourceTextManager.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/SourceTextManager.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/SourceTextManager.cs	Thu Sep 28 06:22:30 2006
@@ -1,4 +1,5 @@
 using System;
+using System.Diagnostics;
 
 using Microsoft.VisualStudio;
 using Microsoft.VisualStudio.TextManager.Interop;
@@ -6,7 +7,6 @@
 using Nemerle.Builtins;
 
 using Nemerle.Completion2;
-using System.Diagnostics;
 
 namespace Nemerle.VisualStudio.LanguageService
 {
@@ -68,8 +68,10 @@
 			int hr1 = Source.GetTextLines().GetLineCount(out lineCount);
 			NativeMethods.ThrowOnFailure(hr1);
 
+			if (line >= lineCount) // just for debugging purpose.
 			Trace.Assert(line < lineCount);
 #endif
+
 			return Source.GetLine(line);
 		}
 



More information about the svn mailing list