[svn] r7799: nemerle/trunk/ncc/parsing/MainParser.n

VladD2 svnadmin at nemerle.org
Fri Sep 14 12:44:08 CEST 2007


Log:
Fix location of event accessors.

Author: VladD2
Date: Fri Sep 14 12:44:07 2007
New Revision: 7799

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

Modified: nemerle/trunk/ncc/parsing/MainParser.n
==============================================================================
--- nemerle/trunk/ncc/parsing/MainParser.n	(original)
+++ nemerle/trunk/ncc/parsing/MainParser.n	Fri Sep 14 12:44:07 2007
@@ -1064,8 +1064,8 @@
 
                       def (kind, bd) = parse_accessor_body ([], impl);
                       def name = Splicable.Name (mkname ("get_" + plain_name));
-                      def fh = Fun_header (toks.Location + nametok.Location, name, ret_type, parms);
-                      def mloc   = nametok.Location + Location_stack.top();
+                      def fh = Fun_header ((toks.Location + nametok.Location).AsGenerated(), name, ret_type, parms);
+                      def mloc   = (nametok.Location + Location_stack.top()).AsGenerated();
                       def member = ClassMember.Function (mloc, fh.name, method_atts, fh, kind, bd);
                       member._env = env;
                       getter = Some (member);
@@ -1088,7 +1088,7 @@
                       def name = Splicable.Name (mkname ("set_" + plain_name));
                       def fh = Fun_header (toks.Location + nametok.Location, 
                                            typarms, name, PExpr.Void (), setter_parms);
-                      def mloc   = nametok.Location + Location_stack.top();
+                      def mloc   = (nametok.Location + Location_stack.top()).AsGenerated();
                       def member = ClassMember.Function (mloc, fh.name, method_atts, fh, kind, bd);
                       member._env = env;
                       setter = Some (member);
@@ -1181,14 +1181,12 @@
               | Token.Identifier (i) as nametok =>
                 match (i) {
                   | "remove" | "add" =>
-                    def mloc = nametok.Location + Location_stack.top();
-
                     if (i == "remove")
                       unless (remove == null)
-                        Message.Error (mloc, "event cannot have multiple remove methods");
+                        Message.Error (nametok.Location, "event cannot have multiple remove methods");
                     else
                       unless (add == null)
-                        Message.Error (mloc, "event cannot have multiple add methods");
+                        Message.Error (nametok.Location, "event cannot have multiple add methods");
 
                     def method_atts = Modifiers (mymods, []);                           
                     take_attributes_out (ref mycustoms, System.AttributeTargets.Method, false, method_atts);
@@ -1199,7 +1197,8 @@
                     def method_parms = [Fun_parm (val_n, ret_type, par_atts)];
                     
                     def (kind, bd) = parse_accessor_body (method_parms, []);
-                    def name = Splicable.Name (mloc, mkname (i + "_" + plain_name));
+                    def mloc = (nametok.Location + Location_stack.top()).AsGenerated();
+                    def name = Splicable.Name (nametok.Location, mkname (i + "_" + plain_name));
                     def fh = Fun_header (mloc, name, PExpr.Void (mloc), method_parms);
                     def method = ClassMember.Function (mloc, name, method_atts, fh, kind, bd);
                     method._env = env;
@@ -1209,7 +1208,7 @@
                       add = method;
 
                   | _ =>
-                    def mloc = nametok.Location;
+                    def mloc = nametok.Location.AsGenerated();
                     def nm = Splicable.Name (loc, mkname (i));
                     def t = parse_return_type (false);
                     def attrs = Modifiers (mymods, []);



More information about the svn mailing list