[svn] r7772: nemerle/trunk/ncc: completion/CodeCompletionEngine.n parsing/MainParser.n typing/TyVar.n

kliss svnadmin at nemerle.org
Sat Aug 25 18:16:25 CEST 2007


Log:
Fix method header locations

Author: kliss
Date: Sat Aug 25 18:16:18 2007
New Revision: 7772

Modified:
   nemerle/trunk/ncc/completion/CodeCompletionEngine.n
   nemerle/trunk/ncc/parsing/MainParser.n
   nemerle/trunk/ncc/typing/TyVar.n

Modified: nemerle/trunk/ncc/completion/CodeCompletionEngine.n
==============================================================================
--- nemerle/trunk/ncc/completion/CodeCompletionEngine.n	(original)
+++ nemerle/trunk/ncc/completion/CodeCompletionEngine.n	Sat Aug 25 18:16:18 2007
@@ -110,22 +110,23 @@
     /// Shift Location.
     public Relocate (loc : Location, info : RelocationInfo) : Location
     {
-      def relocatePoint (oldLn, oldCh, info, ch)
+      // K-Liss: Why passing "info" here as a parameter? It captures parent parameter, doesn't it?
+      def relocatePoint (oldLine, oldColumn, info, column)
       {
-        if (oldLn > info.Line)
-          (oldLn + info.LineOffset, oldCh)
-        else if (oldLn == info.Line && oldCh >= ch)
-          (oldLn + info.LineOffset, oldCh + info.CharOffset)
+        if (oldLine > info.Line)
+          (oldLine + info.LineOffset, oldColumn)
+        else if (oldLine == info.Line && oldColumn >= column)
+          (oldLine + info.LineOffset, oldColumn + info.CharOffset)
         else
-          (oldLn, oldCh) 
+          (oldLine, oldColumn) 
       }
 
       if (loc.FileIndex == info.FileIndex)
       {
-        def (newLn, newCh)       = relocatePoint(loc.Line,    loc.Column,    info, info.Char + 1);
-        def (newEndLn, newEndCh) = relocatePoint(loc.EndLine, loc.EndColumn, info, info.Char);
+        def (newLine, newColumn)       = relocatePoint(loc.Line,    loc.Column,    info, info.Char + 1);
+        def (newEndLine, newEndColumn) = relocatePoint(loc.EndLine, loc.EndColumn, info, info.Char);
 
-        Location (loc, newLn, newCh, newEndLn, newEndCh);
+        Location (loc, newLine, newColumn, newEndLine, newEndColumn);
       }
       else
         loc
@@ -141,25 +142,25 @@
     }
 
     /// Shift Location.
-    public Relocate (loc : Location, line : int, ch : int, lineOffset : int, chOffset : int) : Location
+    public Relocate (loc : Location, line : int, column : int, lineOffset : int, colOffset : int) : Location
     {
-      def relocatePoint (oldLn, oldCh, ch)
+      def relocatePoint (oldLine, oldColumn, column)
       {
-        if (oldLn > line)
-          (oldLn + lineOffset, oldCh)
-        else if (oldLn == line && oldCh >= ch)
-          (oldLn + lineOffset, oldCh + chOffset)
+        if (oldLine > line)
+          (oldLine + lineOffset, oldColumn)
+        else if (oldLine == line && oldColumn >= column)
+          (oldLine + lineOffset, oldColumn + colOffset)
         else
-          (oldLn, oldCh) 
+          (oldLine, oldColumn) 
       }
 
-      def (newLn, newCh)       = relocatePoint(loc.Line,    loc.Column,    ch + 1);
-      def (newEndLn, newEndCh) = relocatePoint(loc.EndLine, loc.EndColumn, ch);
+      def (newLine, newColumn)       = relocatePoint(loc.Line,    loc.Column,    column + 1);
+      def (newEndLine, newEndColumn) = relocatePoint(loc.EndLine, loc.EndColumn, column);
 
-      Location (loc.FileIndex, newLn, newCh, newEndLn, newEndCh);
+      Location (loc.FileIndex, newLine, newColumn, newEndLine, newEndColumn);
     }
     
-    CmpOptins = System.StringComparison.InvariantCultureIgnoreCase;
+    CmpOptions = System.StringComparison.InvariantCultureIgnoreCase;
 
     /// extract information about types/namespaces and add it to 'elems' list.
     public AddTypesAndNamespaces (
@@ -175,7 +176,7 @@
       def scanAndAdd (subNode : NamespaceTree.Node)
       {
         when (subNode.Children != null)
-          foreach (elem when isAll || elem.Key.StartsWith(prefix, CmpOptins) in subNode.Children)
+          foreach (elem when isAll || elem.Key.StartsWith(prefix, CmpOptions) in subNode.Children)
           {
             def name = elem.Key;
             def node = elem.Value;
@@ -198,7 +199,7 @@
         def scanStaticMembers (ti)
         {
           foreach (member in ti.GetMembers (BindingFlags.Public | BindingFlags.Static))
-            when (isAll || member.GetName().StartsWith(prefix, CmpOptins))
+            when (isAll || member.GetName().StartsWith(prefix, CmpOptions))
               elems.Add(Elem.Member (member));
         }
 

Modified: nemerle/trunk/ncc/parsing/MainParser.n
==============================================================================
--- nemerle/trunk/ncc/parsing/MainParser.n	(original)
+++ nemerle/trunk/ncc/parsing/MainParser.n	Sat Aug 25 18:16:18 2007
@@ -850,7 +850,7 @@
                 if (is_property)
                   parse_property (start_tok.Location, mods, customs, id, ret_type, parms, typarms)
                 else {
-                  def header = Fun_header (start_tok.Location + parmsloc + ret_type.Location,
+                  def header = Fun_header (id.Location + parmsloc + ret_type.Location,
                                            name = id,
                                            ret_type = ret_type, 
                                            parms = parms, 
@@ -863,7 +863,7 @@
               | Token.Keyword ("this") =>
                 shift ();
                 def (parms, paramsLoc) = parse_parameters ();
-                def header = Fun_header (start_tok.Location + paramsLoc,
+                def header = Fun_header (tok.Location + paramsLoc,
                                          name = Splicable.Name (tok.Location, mkname (".ctor")),
                                          ret_type = PExpr.Void (),
                                          parms = parms,

Modified: nemerle/trunk/ncc/typing/TyVar.n
==============================================================================
--- nemerle/trunk/ncc/typing/TyVar.n	(original)
+++ nemerle/trunk/ncc/typing/TyVar.n	Sat Aug 25 18:16:18 2007
@@ -71,7 +71,7 @@
     /** Require [this] to be at least [t].
     
         To be called when we require some lower constraint on type
-        variable.  Return [true] iff it's possible.  */
+        variable.  Return [true] if it's possible.  */
     public virtual Require (t : TyVar) : bool
     {
       if (t.IsFixed)



More information about the svn mailing list