[svn] r6886: vs-plugin/trunk: ConsoleTest/Program.cs Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/...

IT svnadmin at nemerle.org
Tue Nov 14 06:44:21 CET 2006


Log:
Fixed outlining for partial classes.

Author: IT
Date: Tue Nov 14 06:44:15 2006
New Revision: 6886

Modified:
   vs-plugin/trunk/ConsoleTest/Program.cs
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Checker.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Type.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Relocation.n

Modified: vs-plugin/trunk/ConsoleTest/Program.cs
==============================================================================
--- vs-plugin/trunk/ConsoleTest/Program.cs	(original)
+++ vs-plugin/trunk/ConsoleTest/Program.cs	Tue Nov 14 06:44:15 2006
@@ -12,9 +12,9 @@
 			Test1 test = new Test1();
 			test.Init();
 
+			test.QuickTip_StackOverflow();
 			test.Check_partial_region();
 			test.Check_region_location();
-			test.QuickTip_StackOverflow();
 			test.QuickTip_TupleProp();
 			test.QuickTip_TupleMethod();
 			test.Complete_enum();

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Checker.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Checker.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Checker.n	Tue Nov 14 06:44:15 2006
@@ -85,8 +85,19 @@
         {
           match (peek())
           {
-          | '/' when peekn(+1) == '/' => c = int.MaxValue - 1;
-          | '/' when peekn(+1) == '*' => return (l, c + 1);
+          | '/' when l == lineIndex => 
+
+            match (peekn(+1))
+            {
+            | '/' 
+            | '*' when line.IndexOf("*/", c) > 0 => c = int.MaxValue - 1;
+            | _ => ()
+            }
+
+          | '/'                     => 
+
+            match (peekn(+1)) { | '/' | '*' => return (l, c + 1); | _ => () }
+
           | ch  when text[0]   == ch  => 
 
             when (text.Length == 1 || line.Substring(c) == text)
@@ -215,19 +226,20 @@
       when (builder.IsDelegate || builder.IsVariantOption)
         return;
 
-      // Region for the type itself.
-      //
-      mutable lineStart = builder.Location.Line;
-      mutable colStart  = builder.Location.Column;
-      mutable lineEnd   = builder.Location.EndLine;
-      mutable colEnd    = builder.Location.EndColumn;
-
-      // Should be temporary solution until we get location for the type name.
-      //
-      colStart = GetLine(lineStart).Length + 1;
+      foreach (loc when loc.FileIndex == _fileIndex in builder.PartsLocation)
+      {
+        _addHiddenRegion(
+          Location(
+            _fileIndex,
+            loc.Line,
+            GetLine(loc.Line).Length + 1, // should be temporary solution until we get location for the type name.
+            loc.EndLine,
+            loc.EndColumn),
+          null,
+          true);
 
-      _addHiddenRegion(Location(_fileIndex, lineStart, colStart, lineEnd, colEnd), null, true);
-      CheckLine(lineStart);
+        CheckLine(loc.Line);
+      }
 
       // Get regions and errors for methods.
       //
@@ -280,50 +292,41 @@
         //
         AddRegion(method.Location.TrimStart(method.fun_header.ret_type_loc, false), true);
 
-      | builder is TypeBuilder   => 
-
-        ProcessBuilder(builder)
-
+      | builder is TypeBuilder   => ProcessBuilder(builder)
       | _ => ()
       }
     }
 
     ProcessDecls(decls : list[Decl]) : void
     {
-      // #regions go first as there is a limitation for the total amount of hidden regions.
-      //
-
       //TODO: Ðåãèîíû ïîêà íå ðåëîêåéòÿòñÿ. Òàê ÷òî ïðè çìåíåíèè èñõîäíèêîâ îíè äîëæíû âðàòü.
       def regions = _project.CompileUnits.GetRegions(_fileIndex);
 
       foreach (r in regions)
       {
-        // Êàêîé ñìûñë â mutable? Äà è âîîáùå çà÷åì êîïèðîâàòü Location â ïåðåìåííûå?
-        mutable lineStart = r.Location.Line;
-        mutable colStart  = r.Location.Column;
-        mutable lineEnd   = r.Location.EndLine;
-        mutable colEnd    = r.Location.EndColumn;
-
-        def str = GetLine(lineStart);
-
-        colStart = str.IndexOf('#') + 1;
-
         _addHiddenRegion(
-          Location(_fileIndex, lineStart, colStart, lineEnd, colEnd),
-          if (r.Text.IsNullOrEmpty()) "#region" else r.Text, false);
+          Location(
+            _fileIndex,
+            r.Location.Line,
+            GetLine(r.Location.Line).IndexOf('#') + 1,
+            r.Location.EndLine,
+            r.Location.EndColumn),
+          if (r.Text.IsNullOrEmpty()) "#region" else r.Text,
+          false);
       }
 
-      def namespaces = List();
+      def usings = List();
 
       foreach (decl in decls)
       {
-      | Decl.Type(builder) when builder.Location.FileIndex == _fileIndex => 
+      | Decl.Type(builder)
+               when builder.PartsLocation.Exists(l => l.FileIndex == _fileIndex) => 
 
         ProcessBuilder(builder)
 
-      | Using as ns when ns.NameLocations.Exists(l => l.FileIndex == _fileIndex) => 
+      | Using as us when us.NameLocations.Exists(l => l.FileIndex == _fileIndex) => 
 
-        namespaces.Add(ns);
+        usings.Add(us);
 
       | Namespace(decls, _, locations, _, _, nsloc) => 
 
@@ -349,19 +352,19 @@
       | _ => ()
       }
 
-      when (namespaces.Count > 1)
+      when (usings.Count > 1)
       {
         mutable usingLoc;
 
-        foreach (ns in namespaces)
+        foreach (us in usings)
         {
-          match (ns.NameLocations.Find(l => l.FileIndex == _fileIndex))
+          match (us.NameLocations.Find(l => l.FileIndex == _fileIndex))
           {
           | Some(loc) => 
 
-            usingLoc = if (usingLoc.IsEmpty()) loc else Utils.Combine(usingLoc, ns.Location);
+            usingLoc = if (usingLoc.IsEmpty()) loc else Utils.Combine(usingLoc, us.Location);
 
-          | _ => ()
+          | None      => ()
           }
         }
 

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Type.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Type.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Type.n	Tue Nov 14 06:44:15 2006
@@ -72,8 +72,9 @@
       }
     }
 
-    //VladD2: IT, äîêóìåíòèðóé, ïîæàëóéñòà, òàêèå ìåòîäû. À òî êàê äîãàäàòüñÿ, ÷òî
-    //        òû èìåë ïîä ýòèìè "object * object".
+    // Finds an object by provided location.
+    // Returns object location * associated Parsetree * associated Typedtree
+    //
     private FindObject(
       typeDecl  : Decl.Type,
       fileIndex : int,

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Relocation.n
==============================================================================



More information about the svn mailing list