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

IT svnadmin at nemerle.org
Wed Feb 21 06:38:54 CET 2007


Log:
Working on ExprFinder.

Author: IT
Date: Wed Feb 21 06:38:51 2007
New Revision: 7455

Modified:
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ExprFinder.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/QuickTipInfo.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Content/QuickTip2.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.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	Wed Feb 21 06:38:51 2007
@@ -107,7 +107,41 @@
             r;
 
           | PExpr.Call(Ref as r, _) when _texprObject is TExpr.MacroEnvelope && IsIn(r.Location) => setobj(r);
+          | PExpr.Call(_, [Tuple(args) as t, Call]) when _texprObject is TExpr.MacroEnvelope && IsIn(t.Location) =>
+
+            match (_texprObject)
+            {
+            | TExpr.MacroEnvelope(_, _, DefFunctionsIn([hdr], _)) when args.Length == hdr.parms.Length =>
+
+              def loop(args : list[PExpr], parms)
+              {
+                def check(l : Located)
+                {
+                  if (IsIn(l.Location))
+                  {
+                    _texprObject = parms.Head;
+                    setobj(l);
+                  }
+                  else
+                    loop(args.Tail, parms.Tail);
+                }
+
+                match (args)
+                {
+                | [] => _pexprObject;
+                | Ref as r :: _
+                | TypeEnforcement(Ref as r, _) :: _ => check(r)
+                | l :: _                            => check(l)
+                }
+              }
+
+              loop(args, hdr.parms);
+
+            | _ => _pexprObject;
+            }
+
           | PExpr.MacroCall(name, _, _) when !IsIn(name.Location) => _texprObject = null; null;
+          | parm is P.Fun_parm when IsIn(parm.name.Location) => setobj(parm.name);
 
           | o => o;
           }

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/QuickTipInfo.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/QuickTipInfo.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/QuickTipInfo.n	Wed Feb 21 06:38:51 2007
@@ -75,7 +75,7 @@
     public this(location : Location, obj : object)
     {
       SetLocation(location);
-      _text = $"Debug: $(obj.GetType()): '$obj'";
+      _text = $"DEBUG: $(obj.GetType()): '$obj'";
     }
 
     private SetLocation(location : Location) : void

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Content/QuickTip2.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Content/QuickTip2.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Content/QuickTip2.n	Wed Feb 21 06:38:51 2007
@@ -10,22 +10,13 @@
 
   public class Class1
   {
-    Operators(val : string)
-    {
-      _ = System.Reflection.BindingFlags.Static %| /*028:-2*/ System.Reflection.BindingFlags.Instance;
-
-      mutable ss = "";
-      foreach (s in [""])
-        ss += /*025:-2*/s;
-
-      _ = "1" + /*022:-1*/ val;
-    }
-
     ParamTest(arr : array[int]) : void
     {
-      def bar(bbb : array[int] /*027:-2*/) {}
+      def bar(bbb /*030:-2*/: array[int] /*027:-2*/) {}
       bar(arr);
 
+      System.Array.Sort(arr, (x /*028:-2*/, y /*029:-2*/: int) => x - y);
+
       def foo( ppp /*012:-2*/) {}
       foo(1);
 
@@ -33,6 +24,15 @@
       _ = arr/*008:-1*/[0];
     }
 
+    Operators(val : string)
+    {
+      mutable ss = "";
+      foreach (s in [""])
+        ss += /*025:-2*/s;
+
+      _ = "1" + /*022:-1*/ val;
+    }
+
     public static TestMType(t : Nemerle.Compiler.MType) : string
     {
     | Fun as f =>

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n	Wed Feb 21 06:38:51 2007
@@ -38,6 +38,9 @@
           Assert.AreEqual(len, result.ColEnd - result.ColStart);
       }
 
+      test("030",  3, "bbb");
+      test("029",  1, "y");
+      test("028",  1, "x");
       test("027", 10, "array [int]");
       test("026",  6, "fromTy");
       test("025",  2, "+=");

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



More information about the svn mailing list