[svn] r6644: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2: CodeModel/ExprFinder.n Engine/Eng...

IT svnadmin at nemerle.org
Mon Sep 11 06:15:56 CEST 2006


Log:
Excluded literals from ExprFinder.

Author: IT
Date: Mon Sep 11 06:15:53 2006
New Revision: 6644

Modified:
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ExprFinder.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine-main.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 Sep 11 06:15:53 2006
@@ -89,7 +89,7 @@
 
     Go(expression : PExpr) : void
     {
-      when (_stop || expression == null || !IsIn(_curLocation))
+      when (_stop || expression == null || expression is PExpr.Literal || !IsIn(_curLocation))
         return;
 
       Print(expression);
@@ -116,8 +116,8 @@
         Go(e);
         l.Iter(Go);
 
-      | Ref    (obj : object)      // { name : Name; }
-      | Literal(obj : object)   => // { val : Nemerle.Compiler.Literal; }
+      | Ref    (obj : object)   => // { name : Name; }
+      //| Literal(obj : object)   => // { val : Nemerle.Compiler.Literal; }
 
         CheckObject(expression.Location, obj);
 
@@ -226,8 +226,9 @@
     public Find(
       root : PExpr,
       line : int,
-      col  : int)
-    : (Location * object)
+      col  : int
+    )
+      : Location * object
     {
       Init(root.Location, line, col);
 
@@ -242,7 +243,7 @@
 
     DoPattern(pattern : Pattern) : void
     {
-      when (_stop || pattern == null || !IsIn(_curLocation))
+      when (_stop || pattern == null || pattern is Pattern.Literal || !IsIn(_curLocation))
         return;
 
       Print(pattern);
@@ -282,14 +283,19 @@
 
         CheckObject(pattern.Location, ht.typ);
 
+      /*
       | Literal(Literal.Enum(_, ty)) => // { lit : Nemerle.Compiler.Literal; }
 
         CheckObject(pattern.Location, ty);
+      */
 
       | Literal            => // { val : Nemerle.Compiler.Literal; }
 
+        /*
         when (!typeof(void).Equals(pattern.SystemType))
           CheckLocated(pattern);
+        */
+        ()
 
       | Tuple(args)        => // { args : list [Pattern]; }
 
@@ -306,7 +312,7 @@
 
     Go(expression : TExpr) : void
     {
-      when (_stop || expression == null || !IsIn(_curLocation))
+      when (_stop || expression == null || expression is TExpr.Literal || !IsIn(_curLocation))
         return;
 
       Print(expression);
@@ -336,7 +342,8 @@
 
         CheckObject(expression.Location, lv)
 
-      | Literal(Literal.Enum(_, ty)) =>
+      /*
+      | Literal(Enum(_, ty)) =>
 
         CheckObject(expression.Location, ty);
 
@@ -344,6 +351,7 @@
 
         when (!typeof(void).Equals(expression.SystemType))
           CheckLocated(expression);
+      */
 
       | Error
       | ImplicitValueTypeCtor
@@ -408,7 +416,7 @@
         unless (body == null)
           Go(body);
 
-      | Sequence(TExpr.Call(TExpr.Base as b, _, _), e2) as seq =>
+      | Sequence(Call(Base as b, _, _), e2) as seq =>
 
         when (seq.Location != b.Location)
           Go(b);
@@ -483,16 +491,16 @@
         {
           foreach ((pattern, pexpr, assigns) in c.patterns)
           {
-            unless (pattern is Pattern.Literal)
+            //unless (pattern is Pattern.Literal)
               DoPattern(pattern);
 
             unless (_stop)
             {
-              unless (pexpr is TExpr.Literal)
+              //unless (pexpr is TExpr.Literal)
                 Go(pexpr);
 
               foreach ((_localValue, aexpr) in assigns)
-                unless (aexpr is TExpr.Literal)
+                //unless (aexpr is TExpr.Literal)
                   Go(aexpr);
             }
 
@@ -500,7 +508,7 @@
               break;
           }
 
-          unless (c.body is TExpr.Literal)
+          //unless (c.body is TExpr.Literal)
             Go(c.body);
 
           when (_stop)

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine-main.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine-main.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine-main.n	Mon Sep 11 06:15:53 2006
@@ -134,7 +134,8 @@
       [NotNull] method   : MethodBuilder, 
       [NotNull] content          : string,
       mutable completionPosition : int
-    ) : CompletionResult
+    )
+      : CompletionResult
       requires completionPosition <= content.Length
     {
         ClearCompilerMessages();
@@ -194,30 +195,26 @@
       /*[NotNull]*/ method   : MethodBuilder,
       /*[NotNull]*/ content  : string,
                     location : Location
-    ) : (FunBody.Parsed * FunBody.Typed * Exception)
+    )
+      : FunBody.Parsed * FunBody.Typed * Exception
     {
         ClearCompilerMessages();
         _isInCompletionMode = true;
 
-        mutable tBody, ex;
-
         def lexer = LexerString(this, content, location);
         def pBody = ParseMethodBody(method, lexer);
 
-        when (pBody != null && pBody.expr != null)
+        if (pBody != null && pBody.expr != null)
         {
           try
           {
             method.RunBodyTyper();
-            tBody = method.GetHeader().body :> FunBody.Typed;
-          }
-          catch
-          {
-          | e => ex = e
+            (pBody, method.GetHeader().body :> FunBody.Typed, null)
           }
+          catch { | ex => (pBody, null, ex) }
         }
-
-        (pBody, tBody, ex)
+        else
+          (pBody, null, null)
     }
   } // end class Engine
 } // end namespace



More information about the svn mailing list