[svn] r6460: nemerle/trunk/ncc: hierarchy/TypeBuilder.n parsing/MainParser.n

VladD2 svnadmin at nemerle.org
Sat Jul 22 22:27:29 CEST 2006


Log:
Has added PartsLocation property to TypeBuilder. Fix start location calculation of TypeBuilder. It's need for correct identify of partial types bodies in completion engine.

Author: VladD2
Date: Sat Jul 22 22:27:27 2006
New Revision: 6460

Modified:
   nemerle/trunk/ncc/hierarchy/TypeBuilder.n
   nemerle/trunk/ncc/parsing/MainParser.n

Modified: nemerle/trunk/ncc/hierarchy/TypeBuilder.n
==============================================================================
--- nemerle/trunk/ncc/hierarchy/TypeBuilder.n	(original)
+++ nemerle/trunk/ncc/hierarchy/TypeBuilder.n	Sat Jul 22 22:27:27 2006
@@ -66,6 +66,7 @@
   pt_name : PT.Name;
   name : string;
   loc : Location;
+  [Accessor] mutable parts_location : list [Location];
   modifiers : Modifiers;
   mutable attributes : NemerleAttributes;
   accessibility : Accessibility;
@@ -116,6 +117,7 @@
 
     this.name = pt_name.Id;
     this.loc = td.loc;
+    this.parts_location = [td.loc];
     modifiers = td.modifiers;
     attributes = modifiers.mods;
 
@@ -1325,6 +1327,8 @@
               {}
             | _ => Define (x)
           }
+
+        this.parts_location ::= additional.Location;
       | _ =>
         Message.Error (additional.loc, "`partial' modifier can be used only"
                        " before `class', `struct', `interface' or `variant'")

Modified: nemerle/trunk/ncc/parsing/MainParser.n
==============================================================================
--- nemerle/trunk/ncc/parsing/MainParser.n	(original)
+++ nemerle/trunk/ncc/parsing/MainParser.n	Sat Jul 22 22:27:27 2006
@@ -535,7 +535,7 @@
       def mods = Modifiers (get_modifiers (), []);
       take_attributes_out (ref customs_token, System.AttributeTargets.Class, true, mods);
 
-      def result = ParseTypeDeclaration (mods);
+      def result = ParseTypeDeclaration (mods, toks.Location);
       pop_stream ("type declaration");
 
       result;
@@ -544,7 +544,7 @@
     /** Parses toplevel type (like class, interface, etc.).
         We are inside stream with modifiers and custom attributes already read.
      */
-    ParseTypeDeclaration (mods : Modifiers) : TopDeclaration
+    ParseTypeDeclaration (mods : Modifiers, startLocation : Location) : TopDeclaration
     {
       def tok = get_token ();
       def res =
@@ -619,14 +619,14 @@
                     | _ => Util.ice ()
                   };
                 td.name = name;
-                td.loc = tok.Location + end_loc;
+                td.loc = startLocation + end_loc;
                 td
 
               | "delegate" =>
                 def h = parse_fun_header (null);
                 def td = TopDeclaration.Delegate (h);
                 expect_empty ("delegate declaraion");
-                td.loc = tok.Location + h.Location;
+                td.loc = startLocation + h.Location;
                 td.name = h.name;                
                 td
 
@@ -645,7 +645,7 @@
                 def expr = parse_block ([]);
                 def res = TopDeclaration.Macro (header, synt, expr);
                 res.name = header.name;
-                res.loc = tok.Location + header.Location;
+                res.loc = startLocation + header.Location;
                 res
 
               | _ => Error (tok, "expecting type declaration"); TopDeclaration.Delegate (null);
@@ -737,7 +737,7 @@
 
               | _ =>
                 take_attributes_out (ref customs, System.AttributeTargets.Class, true, mods);
-                def td = ParseTypeDeclaration (mods);
+                def td = ParseTypeDeclaration (mods, tok.Location);
                 ClassMember.TypeDeclaration (loc = td.loc, 
                                              name = td.name, 
                                              modifiers = td.modifiers, 



More information about the svn mailing list