[svn]
r6643: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2:
CodeModel/Project.Relocation.n Co...
VladD2
svnadmin at nemerle.org
Mon Sep 11 00:52:07 CEST 2006
Log:
Sync with compiler
Author: VladD2
Date: Mon Sep 11 00:52:02 2006
New Revision: 6643
Modified:
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Relocation.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Type.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/CompletionElem.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine-Relocation.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine-main.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.Init.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Relocation.n
==============================================================================
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Type.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Type.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Type.n Mon Sep 11 00:52:02 2006
@@ -28,22 +28,11 @@
| method is MethodBuilder =>
// Adjust the body location...
def loc = method.BodyLocation;
- def sl = loc.Line;
- def el = loc.EndLine;
-
- // IT: ÷ňî ĺńëč čńďîëüçóĺňń˙ âŕđčŕíň ńčíňŕęńčńŕ áĺç ńęîáîę?
- //
- def colStart = loc.Column + 1; // exclude open brace
- def colEnd = loc.EndColumn - 1; // exclude close brace
- def loc = Location(loc.FileIndex, loc.Line, colStart, loc.EndLine, colEnd);
-
- ignore(sl);
- ignore(el);
if (loc.Contains(line, col)) // completion in method body
{
- def bodyCode = getText(loc.Line, colStart, loc.EndLine, colEnd);
- def completionCode = getText(loc.Line, colStart, line, col);
+ def bodyCode = getText(loc.Line, loc.Column, loc.EndLine, loc.EndColumn);
+ def completionCode = getText(loc.Line, loc.Column, line, col);
def result = _engine.RunCompletionEngine(method, bodyCode, completionCode.Length);
if (result == null)
@@ -102,7 +91,7 @@
if (loc.Contains(line, col)) // in method body
{
- mutable bodyCode = getText(loc.Line, loc.Column, loc.EndLine, loc.EndColumn);
+ def bodyCode = getText(loc.Line, loc.Column, loc.EndLine, loc.EndColumn);
def (pBody, tBody, _) = _engine.CompileMethod(method, bodyCode, loc);
@@ -206,7 +195,7 @@
if (location.Contains(line, col)) // in method body
{
- mutable bodyCode = getText(location.Line, location.Column, location.EndLine, location.EndColumn);
+ def bodyCode = getText(location.Line, location.Column, location.EndLine, location.EndColumn);
def (pBody, tBody, _) = _engine.CompileMethod(method, bodyCode, location);
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.n Mon Sep 11 00:52:02 2006
@@ -114,10 +114,12 @@
GetActiveDecl(_compileUnits.GetFileIndex(filePath), line, col)
}
- public GetQuickTipInfo([NotNull] filePath : string, line : int, col : int, getText : GetText) : QuickTipInfo
+ public GetQuickTipInfo(/*[NotNull]*/ filePath : string, line : int, col : int, getText : GetText) : QuickTipInfo
{
+ def a = 0;
def fileIndex = _compileUnits.GetFileIndex(filePath);
def decl = GetActiveDecl(fileIndex, line, col);
+ ignore(a);
match (decl)
{
@@ -157,8 +159,7 @@
| method is MethodBuilder =>
def location = method.BodyLocation;
-
- mutable bodyCode = getText(location.Line, location.Column, location.EndLine, location.EndColumn);
+ def bodyCode = getText(location.Line, location.Column, location.EndLine, location.EndColumn);
_ = _engine.CompileMethod(method, bodyCode, location);
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/CompletionElem.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/CompletionElem.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/CompletionElem.n Mon Sep 11 00:52:02 2006
@@ -26,6 +26,7 @@
{
def builder = Text.StringBuilder();
+ when (Overloads != null)
foreach (overload in Overloads)
{
| Local (value) => _ = builder.AppendLine(value.MakeHint());
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine-Relocation.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine-Relocation.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine-Relocation.n Mon Sep 11 00:52:02 2006
@@ -23,18 +23,20 @@
oldEndChar : int, oldEndLine : int
) : void
{
- def (firstLine, firstChar, lineOffset, charOffset) =
- if (newEndLine == oldEndLine && newEndChar > oldEndChar)
- (oldEndLine, oldEndChar, 0, newEndChar - oldEndChar)
- else
- (oldEndLine, oldEndChar, newEndLine - oldEndLine, 0);
+ def a = Math.Max(oldEndLine, newEndLine);
+ def firstLine = a;
+ def firstChar = if (newEndLine == oldEndLine && newEndChar > oldEndChar) newEndChar else oldEndChar;
+ def lineOffset = newEndLine - oldEndLine;
+ def charOffset = newEndChar - oldEndChar;
+
+ assert(firstLine == Math.Max(oldEndLine, newEndLine));
- def relMap = RelocationMaps[fileIndex];
+ def relMap = Location.RelocationMaps[fileIndex];
if (relMap == null) // no relocations
{
def newMap = SCG.List();
- RelocationMaps[fileIndex] = newMap;
+ Location.RelocationMaps[fileIndex] = newMap;
newMap.Add(Relocation(firstLine, firstChar, lineOffset, charOffset));
}
else // exists some relocations
@@ -50,8 +52,14 @@
else
{
def rel = relMap[index];
+ def newLineOffset = rel.LineOffset + lineOffset;
+ def newCharOffset = rel.ColumnOffset + charOffset;
+
+ if (newLineOffset == 0 && newCharOffset == 0)
+ _ = relMap.RemoveAt(index);
+ else
relMap[index] = Relocation(firstLine, Math.Min(firstChar, rel.Column),
- rel.LineOffset + lineOffset, rel.ColumnOffset + charOffset)
+ newLineOffset, newCharOffset)
}
for (mutable i = index + 1; i < relMap.Count; i++)
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine-main.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine-main.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine-main.n Mon Sep 11 00:52:02 2006
@@ -125,7 +125,9 @@
protected ClearRelocationMaps() : void
{
- Array.Clear(RelocationMaps, 0, RelocationMaps.Length);
+ def map = Location.RelocationMaps;
+ for (mutable i = 0; i < map.Count; i++)
+ map[i] = null;
}
public RunCompletionEngine (
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.Init.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.Init.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.Init.n Mon Sep 11 00:52:02 2006
@@ -27,6 +27,7 @@
{
options.GreedyReferences = false;
base (options);
+ Location.IsUseRelocationMaps = true;
Output = output;
_state = EngineState.Pure;
_isInCompletionMode = true;
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n Mon Sep 11 00:52:02 2006
@@ -13,6 +13,24 @@
[TestFixture]
public partial class Test1
{
+ [Test]
+ public Complete_GlabalNs_in_NestedNs() : void
+ {
+ def file = FilePath1;
+ def (line, col) = ReadLocation(file, "Complete glabal ns");
+ def result = _project.CompleteWord(file, line, col, GetTextFromFile(file, _, _, _, _));
+ Assert.IsNotNull(result, "result is null");
+ Assert.AreEqual(2, result.Length, "Expected 2 elements.");
+ }
+
+ [Test]
+ public PrintTypes() : void
+ {
+ def tree = _project.NamespaceTree;
+ Assert.IsNotNull(tree, "result is null");
+ }
+
+ [Test]
public Hint_in_body_of_implicit_match() : void
{
def file = FilePath1;
@@ -185,16 +203,6 @@
}
[Test]
- public Complete_GlabalNs_in_NestedNs() : void
- {
- def file = FilePath1;
- def (line, col) = ReadLocation(file, "Complete glabal ns");
- def result = _project.CompleteWord(file, line, col, GetTextFromFile(file, _, _, _, _));
- Assert.IsNotNull(result, "result is null");
- Assert.AreEqual(2, result.Length, "Expected 2 elements.");
- }
-
- [Test]
public Complete_Complete_aliased_type() : void
{
def file = FilePath1;
More information about the svn
mailing list