[svn] r7435: nemerle/trunk/ncc/parsing/MainParser.n vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Complet...

IT svnadmin at nemerle.org
Fri Feb 16 04:02:19 CET 2007


Log:
Working on ExprFinder.

Author: IT
Date: Fri Feb 16 04:02:14 2007
New Revision: 7435

Modified:
   nemerle/trunk/ncc/parsing/MainParser.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ExprFinder.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Content/QuickTip2.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n

Modified: nemerle/trunk/ncc/parsing/MainParser.n
==============================================================================
--- nemerle/trunk/ncc/parsing/MainParser.n	(original)
+++ nemerle/trunk/ncc/parsing/MainParser.n	Fri Feb 16 04:02:14 2007
@@ -2138,8 +2138,8 @@
                     PExpr.Match (loc, expr, [MatchCase ([], e)]);
                   | _        => Util.ice ()
                 }
-              | Token.BracesGroup (group) =>
-                PExpr.Match (loc, expr, process_groups (group, "match body", parse_match_case))
+              | Token.BracesGroup (group) as tok =>
+                PExpr.Match (loc.Combine(tok.Location), expr, process_groups (group, "match body", parse_match_case))
                 
               | x => fatal_error (x, "expecting '{' after 'match (e)'");
             }

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	Fri Feb 16 04:02:14 2007
@@ -25,6 +25,7 @@
     {
       | pe is PExpr        => pe.TypedObject;
       | fh is P.Fun_header => fh.TypedObject;
+      | fp is P.Fun_parm   => fp.TypedObject;
       | sp is Splicable    => sp.TypedObject : object;
       | _                  => null;
     }
@@ -106,10 +107,21 @@
           _texprObject = match (_texprObject)
           {
           | TExpr.DefValIn      (name, _, _)     when IsInEx(name.NameLocation) => setloc(name, name.NameLocation);
-          | TExpr.TypeConversion(_, ty, _, tloc) when IsInEx(tloc)              => setloc(ty,   tloc);
+          | TExpr.TypeConversion   (_, ty, _, tloc) when IsInEx(tloc)              => setloc(ty,   tloc);
           | Pattern.As          (_, decl)        when IsInEx(decl.NameLocation) => decl;
-          | TExpr.LocalRef      (val)       => val;
-          | TExpr.StaticRef     (_, mem, _) => mem : object;
+          | parm is T.Fun_parm      => parm.decl;
+          | TExpr.ConstantObjectRef(_, o)
+          | TExpr.StaticPropertyRef(_, o)
+          | TExpr.StaticEventRef   (_, o)
+          | TExpr.Base                (o)
+          | TExpr.EventMember      (_, o)
+          | TExpr.FieldMember      (_, o)
+          | TExpr.PropertyMember   (_, o)
+          | TExpr.LocalRef            (o : object)
+          | TExpr.LocalFunRef         (o, _)
+          | TExpr.StaticRef        (_, o, _)
+          | TExpr.HasType          (_, o)
+          | TExpr.TypeOf              (o)
           | o                               => o;
           }
 
@@ -213,3 +225,4 @@
     }
   }
 }
+  
\ No newline at end of file

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	Fri Feb 16 04:02:14 2007
@@ -4,6 +4,24 @@
 {
   public class Class1
   {
+    MatchTest(sss : string) : void
+    {
+      def chk (x, n) { x == n }
+      match (sss.Length)
+      {
+      | xx /*014:-2*/ when chk /*015:-2*/(xx, 1) => ()
+      | _ => ();
+      }
+
+      def foo(ss)
+      {
+      | xx/*013:-1*/ when xx.Length == 0 => ();
+      | _ => ();
+      }
+
+      foo(sss);
+    }
+
     ParamTest(arr : array[int]) : void
     {
       def foo( ppp /*012:-2*/) {}

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	Fri Feb 16 04:02:14 2007
@@ -38,6 +38,9 @@
           Assert.AreEqual(len, result.ColEnd - result.ColStart);
       }
 
+      test("015", 3, "chk");
+      test("014", 2, "xx");
+      test("013", 2, "xx");
       test("012", 3, "ppp");
       test("011", 2, "ch");
       test("010", 3, "iii");



More information about the svn mailing list