[svn] r7275: nemerle/trunk: NCC.nproj ncc/hierarchy/ClassMembers.n ncc/parsing/AST.n

VladD2 svnadmin at nemerle.org
Tue Jan 16 15:33:42 CET 2007


Log:
Move BodyLocation calcs into CalcExclusiveBodyLocation() method.

Author: VladD2
Date: Tue Jan 16 15:33:40 2007
New Revision: 7275

Modified:
   nemerle/trunk/NCC.nproj
   nemerle/trunk/ncc/hierarchy/ClassMembers.n
   nemerle/trunk/ncc/parsing/AST.n

Modified: nemerle/trunk/NCC.nproj
==============================================================================

Modified: nemerle/trunk/ncc/hierarchy/ClassMembers.n
==============================================================================
--- nemerle/trunk/ncc/hierarchy/ClassMembers.n	(original)
+++ nemerle/trunk/ncc/hierarchy/ClassMembers.n	Tue Jan 16 15:33:40 2007
@@ -773,8 +773,9 @@
     internal set { is_extension = value }
   }
 
+  /// Exclusive methode body location.
   [Accessor (flags = Override)]
-  protected mutable body_location : Location;
+  protected mutable _bodyLocation : Location;
   
   is_var_args : bool;
 
@@ -1058,22 +1059,7 @@
 
     mutable fun_body = f.body;
 
-    match (fun_body) {
-      | Parsed (e) =>
-        def loc = e.Location;
-        
-        body_location = 
-          if (loc.IsGenerated)
-            loc
-          else if (Location.IsFileInIndentationSyntax(loc.FileIndex))
-            loc
-          else if (loc.Line == loc.EndLine && loc.EndColumn - loc.Column < 2)
-            Location.Default;
-          else
-            Location(loc.FileIndex, loc.Line, loc.Column + 1, loc.EndLine, loc.EndColumn - 1);
-
-      | _ => {}
-    }
+    _bodyLocation = fun_body.CalcExclusiveBodyLocation ();
     
    /* We need to convert things like:
         foo (x : int * int) : int { bar }

Modified: nemerle/trunk/ncc/parsing/AST.n
==============================================================================
--- nemerle/trunk/ncc/parsing/AST.n	(original)
+++ nemerle/trunk/ncc/parsing/AST.n	Tue Jan 16 15:33:40 2007
@@ -934,6 +934,26 @@
     | Typed { expr : Typedtree.TExpr; }
     | ILed
     | Abstract  // for interface method
+
+    /// If Body is FunBody.Parsed, calculate exclusive body location.
+    public CalcExclusiveBodyLocation () : Location
+    {
+      match (this) {
+        | FunBody.Parsed (e) =>
+          def loc = e.Location;
+          
+          if (loc.IsGenerated)
+            loc
+          else if (Location.IsFileInIndentationSyntax(loc.FileIndex))
+            loc
+          else if (loc.Line == loc.EndLine && loc.EndColumn - loc.Column < 2)
+            Location.Default;
+          else
+            Location(loc.FileIndex, loc.Line, loc.Column + 1, loc.EndLine, loc.EndColumn - 1);
+
+        | _ => Location.Default;
+      }
+    }
   }
 
   public variant FunKind



More information about the svn mailing list