[svn] r7269: vs-plugin/trunk/Nemerle.Compiler.Utils: Nemerle.Completion2/CodeModel/ExprFinder.n Nemerle.Co...

IT svnadmin at nemerle.org
Mon Jan 15 16:56:52 CET 2007


Log:
Fixed GetActiveMembers for internal classes.

Author: IT
Date: Mon Jan 15 16:56:49 2007
New Revision: 7269

Modified:
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ExprFinder.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/TokenFinder.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Utils.n

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ExprFinder.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ExprFinder.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ExprFinder.n	Mon Jan 15 16:56:49 2007
@@ -260,7 +260,7 @@
 
         if (_pexprObject != null)
         {
-#if PRINT_AST
+#if PRINT_AST && DEBUG
           Trace.WriteLine("");
           Trace.WriteLine(
             $"PExpr: $(_pexprLocation.Line):$(_pexprLocation.Column):"
@@ -293,7 +293,7 @@
 
     Init(line : int, col : int) : void
     {
-#if PRINT_AST
+#if PRINT_AST && DEBUG
       Trace.WriteLine($"\nStart at: $line:$col.");
 #endif
 
@@ -313,7 +313,7 @@
     {
       _ = obj.ToString();
 
-#if PRINT_AST
+#if PRINT_AST && DEBUG
       mutable s = "";
 
       for (mutable i = 0; i < level; i++)
@@ -338,7 +338,7 @@
 
     PrintAdd(level : int) : void
     {
-#if PRINT_AST
+#if PRINT_AST && DEBUG
       mutable s = "";
 
       for (mutable i = 0; i < level; i++)

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/TokenFinder.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/TokenFinder.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/TokenFinder.n	Mon Jan 15 16:56:49 2007
@@ -78,7 +78,7 @@
 
     Init(rootLocation : Location, line : int, col : int) : void
     {
-#if PRINT_AST
+#if PRINT_AST && DEBUG
       Trace.WriteLine($"\nStart at: $line:$col.");
 #endif
 
@@ -104,7 +104,7 @@
 
     Print(obj : object, loc : Location, level : int) : void
     {
-#if PRINT_AST
+#if PRINT_AST && DEBUG
       mutable s = "";
 
       for (mutable i = 0; i < level; i++)

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Utils.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Utils.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Utils.n	Mon Jan 15 16:56:49 2007
@@ -207,41 +207,6 @@
       glyphType :> int;
     }
 
-    public GetActiveMember(this typeBuilder : TypeBuilder, 
-      fileIndex : int, line : int, col : int) : IMember
-    { //FixMe: if remove type annotation ( : list[IMember]) code will not compile.
-      def loop(members : list[IMember])
-      {
-        | member :: tail            => 
-          match (member)
-          {
-            | tb is TypeBuilder =>
-              if (tb.Location.Contains(fileIndex, line, col))
-                GetActiveMember(tb, fileIndex, line, col);
-              else
-                loop(tail)
-
-            | _ =>
-              //when (typeBuilder.Name == "SourceCollection") //member.Name == ".ctor"
-              //  Trace.Assert(false);
-              if (member.Location.Contains(fileIndex, line, col) 
-                && !(member.Attributes %&& NemerleAttributes.SpecialName)
-              )
-                member
-              else
-                loop(tail)
-          }
-
-        | [] => null
-      }
-
-      def members = typeBuilder.GetMembers(BindingFlags.Static 
-        %| BindingFlags.Instance %| BindingFlags.Public 
-        %| BindingFlags.NonPublic %| BindingFlags.DeclaredOnly);
-
-      loop(members);
-    }
-
     public GetActiveMember(
       this typeBuilder : TypeBuilder, 
       fileIndex        : int,
@@ -252,7 +217,7 @@
       : IMember
     {
       assert(true);
-      def members = typeBuilder.GetActiveMembers(fileIndex, line, col);
+      def members = typeBuilder.GetActiveMembers(fileIndex, line, col, comparator);
 
       def filter(mlist)
       {
@@ -268,11 +233,23 @@
       filter(members)
     }
 
-    public GetActiveMembers(
+    public GetActiveMember(
       this typeBuilder : TypeBuilder,
       fileIndex        : int,
       line             : int,
-      col              : int
+      col              : int,
+    )
+      : IMember
+    {
+      typeBuilder.GetActiveMember(fileIndex, line, col, (m, _) => m);
+    }
+
+    public GetActiveMembers1(
+      this typeBuilder : TypeBuilder,
+      fileIndex        : int,
+      line             : int,
+      col              : int,
+      comparator       : IMember * IMember -> IMember
     )
       : list[IMember]
     {
@@ -285,7 +262,7 @@
         {
         | tb is TypeBuilder   =>
 
-          def member = GetActiveMember(tb, fileIndex, line, col);
+          def member = tb.GetActiveMember(fileIndex, line, col, comparator);
 
           if (member == null) loop(tail) else member :: loop(tail)
 
@@ -316,6 +293,17 @@
       loop(members);
     }
 
+    public GetActiveMembers(
+      this typeBuilder : TypeBuilder,
+      fileIndex        : int,
+      line             : int,
+      col              : int
+    )
+      : list[IMember]
+    {
+      typeBuilder.GetActiveMembers(fileIndex, line, col, (m, _) => m);
+    }
+
     public GetLocalPath(this asm : Assembly) : string
     {
        Uri(asm.CodeBase).LocalPath;



More information about the svn mailing list