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

IT svnadmin at nemerle.org
Tue Dec 5 05:53:17 CET 2006


Log:
Fixed location definition for usage.

Author: IT
Date: Tue Dec  5 05:53:15 2006
New Revision: 7048

Modified:
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ExprFinder.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	Tue Dec  5 05:53:15 2006
@@ -111,13 +111,24 @@
                 else
                 {
                   definitionFound = true;
-                  Debug.WriteLine($"    it's a definition! (location: $(entry.Location))");
-                  localValueEntries ::= GotoInfo(node.Location, UsageType.Definition);
+
+                  def loc = match (node)
+                  {
+                  | DefValIn(name, _, _) => name.NameLocation;
+                  | _                    => node.Location;
+                  }
+
+                  #if phantom
+                  Debug.WriteLine($"    it's a definition! (location: $(loc))");
+                  #endif
+                  localValueEntries ::= GotoInfo(loc, UsageType.Definition);
                 }
               }
               else
               {
+                #if phantom
                 Debug.WriteLine($"    it's a reference! (location: $(entry.Location))");
+                #endif
                 localValueEntries ::= GotoInfo(node.Location, UsageType.Usage);
               }
             }
@@ -346,6 +357,8 @@
       // Â Nemerle äîïóñòèìî ñîçäàâàòü imutable-ïåðåìåííûå ïåðåêðûâàþùèå èìåíà äðóãèõ imutable-ïåðåìåííûõ.
       // Òàê ÷òî èñïîëüçîâàíèå RemoveDuplicates() ìîæåò áûòü îøèáêîé. Íàäî ðàçáèðàòüñÿ ñ ïåðåìåííûìè
       // áîëåå äåòàëüíî. Íàõîäèòü ñàìîå âëîæåííîå îáúÿâëåíèå.
+      // IT: ïî èäåå íè ñ ÷åì ðàçáèðàòüñÿ íå íàäî. Ó êàæäîé ïåðåìåííîé èìååòñÿ ññûëêà íà òî, ãäå îíà îáúÿâëåíà.
+      // Âîò ýòó ññûëêó è íàäî ñðàâíèâàòü. Âñå îñòàëüíûå ïîòóãè áóäóò ïî-ëþáîìó íå òî÷íûìè.
       //phantom: Â ýòîì òåñò-êåéñå êîä âèäà "foo += _;" - îí ìàêðîñîì ïðåîáðàçîâûâàåòñÿ â "foo = foo + _;".
       // Òàê ÷òî RemoveDuplicates ñîâñåì íå ëèøíèé. Îñòàëîñü ïðîäóìàòü òùàòåëüíî ðàáîòó ñ ìàêðîñàìè è íå ïîåõàòü ìîçãàìè ïðè ýòîì ;)
       def entries = localValueEntries.Reverse().RemoveDuplicates(); // phantom: test case 3 (test project 1) returns duplicate entries



More information about the svn mailing list