[svn] r7325: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/MethodTipInfo.n

IT svnadmin at nemerle.org
Tue Jan 23 22:12:51 CET 2007


Log:
Fixed a MethodTipInfo bug.

Author: IT
Date: Tue Jan 23 22:12:49 2007
New Revision: 7325

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

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/MethodTipInfo.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/MethodTipInfo.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/MethodTipInfo.n	Tue Jan 23 22:12:49 2007
@@ -12,7 +12,6 @@
     public this([NotNull] overloads : List[OverloadPossibility], tokens : list[Token])
     {
       _overloads = overloads;
-      _tokens    = tokens;
 
       _overloads.Sort((x, y) =>
       {
@@ -22,11 +21,10 @@
         xparms.Length - yparms.Length;
       });
 
-      Init();
+      Init(tokens);
     }
 
-    _overloads : List[OverloadPossibility];
-    _tokens    : list[Token];
+    mutable _overloads : List[OverloadPossibility];
 
     [Accessor] mutable _startName       : Location;
     [Accessor] mutable _startParameters : Location;
@@ -34,27 +32,23 @@
     [Accessor] mutable _endParameters   : Location;
     [Accessor] mutable _defaultMethod   : int;
 
-    Init() : void
+    Init(tokens : list[Token]) : void
     {
-      def memberName = GetName(0);
-
-      def findRoundGroup(tokens) 
+      def findRoundGroup(toks) 
       {
-      | h :: t => if (h is Token.RoundGroup) tokens else findRoundGroup(t)
+      | h :: t => if (h is Token.RoundGroup) toks else findRoundGroup(t)
       | _      => []
       }
 
-      def findIdentifier(token : Token) 
+      def findIdentifier(group, token : Token)
       {
-      | Identifier(name) when name == memberName && token.Next == null => token
-      | Identifier(name) when name == memberName                       => 
-
-        def t = findIdentifier(token.Next);
-        if (t == null) token else t
-
-      | LooseGroup(child)         => findIdentifier(child)
-      | _ when token.Next != null => findIdentifier(token.Next);
-      | _                         => null
+        match(token)
+        {
+        | Identifier when token.Next == null || group.Equals(token.Next) => token
+        | LooseGroup(child) => findIdentifier(group, child)
+        | null              => null;
+        | _                 => findIdentifier(group, token.Next);
+        }
       }
 
       def findComma(token : Token) 
@@ -73,14 +67,18 @@
       | _ => ()
       }
 
-      match (findRoundGroup(_tokens))
+      match (findRoundGroup(tokens))
       {
       | group :: prev :: _ => 
 
-        def token = findIdentifier(prev);
+        def token = findIdentifier(group, prev);
 
-        when (token != null)
+        when (token is Token.Identifier)
         {
+          def name = (token :> Token.Identifier).name;
+
+          _overloads = _overloads.FindAll(o => o.Member.Name == name);
+
           _startName       = token.Location;
           _startParameters = group.Location;
 



More information about the svn mailing list