[svn] r7177: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine: Engine-main.n Engine.Parse...

VladD2 svnadmin at nemerle.org
Sun Dec 31 05:17:07 CET 2006


Log:
Fix location of top namespace.

Author: VladD2
Date: Sun Dec 31 05:17:02 2006
New Revision: 7177

Modified:
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine-main.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.ParseEvents.n

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine-main.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine-main.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine-main.n	Sun Dec 31 05:17:02 2006
@@ -46,6 +46,7 @@
         foreach (fileIndex in Sources.GetFileIndices())
         {
           _fileIndex = fileIndex;
+          mutable endLoc;
           def source = projSources.GetSource(fileIndex);
           def code = source.GetText();
           BeginParseFile(fileIndex);
@@ -54,9 +55,10 @@
             def lexer = LexerString (this, code, Location(_fileIndex, 1, 1));
             def decls = ParsingPipeline (lexer);
             regionsMap.Add(fileIndex, lexer.Regions);
+            endLoc = lexer.Location;
             trees ::= decls.Rev();
           }
-          finally { EndParseFile(fileIndex); }
+          finally { EndParseFile(fileIndex, endLoc); }
         }
          
         // create N.C.TypeBuilders for all parsed types and add them to namespace hierarchy

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.ParseEvents.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.ParseEvents.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.ParseEvents.n	Sun Dec 31 05:17:02 2006
@@ -42,19 +42,12 @@
     // HACK: see usings
     public static VeryBigNumber = 1000000;
     
-    EndParseFile(fileIndex : int) : void
+    EndParseFile(fileIndex : int, endLocation : Location) : void
     {
-      // TODO: performance decreasing on source.GetText() - implement LastPosition in lexer
-      //def source = ProjectSources.GetSource(fileIndex);
-      //def (lastLine, lastColumn) = source.GetLineIndexOfPosition(source.GetText().Length);
-      //def location = Location(fileIndex, 1, 1, lastLine, lastColumn);
-
-      // HACK: implement LastPosition in lexer to get rid of this hack
-      // related hack: in Project.Refactoring.GetChainOfEnclosingLocations()
-      def location = Location(fileIndex, 1, 1, VeryBigNumber, 1);
+      def loc = Location(fileIndex, 1, 1, endLocation.EndLine, endLocation.EndColumn);
       
-      _fileInfos[fileIndex] = Decl.Namespace(location, _decls.Rev(), [], [], 
-        CoreEnv, CoreEnv, location);
+      _fileInfos[fileIndex] = Decl.Namespace(loc, _decls.Rev(), [], [], 
+        CoreEnv, CoreEnv, loc);
 
       _decls = [];
       assert(_namespaces.Count == 0);



More information about the svn mailing list