[svn] r6833: vs-plugin/trunk:
Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Type.n
Nemerle....
IT
svnadmin at nemerle.org
Sun Nov 5 05:45:15 CET 2006
Log:
Little refactoring.
Author: IT
Date: Sun Nov 5 05:45:09 2006
New Revision: 6833
Modified:
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/Engine.Properties.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Utils.n
vs-plugin/trunk/Nemerle.VsIntegration/Project/ProjectInfo.cs
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 Sun Nov 5 05:45:09 2006
@@ -86,17 +86,6 @@
else typeBuilder.GetActiveMember(fileIndex, line, col,
fun(m1, m2)
{
- // Ýňîň ęîä âűëĺňŕĺň ďî NulReferenceException ĺńëč, íŕďđčěĺđ, íŕâĺńňč
- // ęóđńîđ íŕ "Message_output" â ńňđîęĺ 46 ôŕéëŕ:
- // Nemerle.Compiler.Utils\Nemerle.Completion2\Engine\Engine.Properties.n
-
- // PB061101: Çŕáčë ďîęŕ ęîńňűëü ÷ňîáű đŕáîňŕëî.
- if (m1 == null)
- m2
- else if (m2 == null)
- m1
- else
- {
def loc1 = m1.Location;
def loc2 = m2.Location;
@@ -104,7 +93,6 @@
if (m2 is PropertyBuilder) m2 else m1
else
if (loc1.Intersect(loc2) == loc1) m1 else m2
- }
});
match (member)
@@ -151,7 +139,6 @@
fileIndex : int,
line : int,
col : int,
- source : ISource,
//2IT: ďđŕęňč÷ĺńęč ëţáîé ęëŕńń â ęîěďčë˙ňîđĺ ńîäĺđćčň ńńűëęó íŕ ManagerClass.
// Ďî ęđŕéíĺé ěĺđĺ MemberBuilder č TypeBuilder ňî÷íî čő čěĺţň.
// Ňŕę ÷ňî ýňîň ďŕđŕěĺňđ ńęîđĺĺ âńĺăî îřčáęŕ.
@@ -165,14 +152,9 @@
{
| me is TExpr.MacroEnvelope => (QuickTipInfo(loc, me))
| lv is LocalValue => (QuickTipInfo(loc, lv))
- // IMember đĺŕëčçóţň âńĺ íŕńëĺäíčęč MemberBuilder.  ňîě ÷čńëĺ č FieldBuilder.
- // Ňŕę ÷ňî ďđîâĺđęŕ íŕ ýňîň číňĺđôĺéń äîëćíŕ čäňč â ńŕěîě ęîíöĺ.
| mm is IMember => (QuickTipInfo(loc, mm, manager))
| tv is TyVar => (QuickTipInfo(loc, tv))
| fh is Typedtree.Fun_header => (QuickTipInfo(loc, fh))
- | fb is FieldBuilder => (QuickTipInfo(fb.Location, fb, manager))
- | pb is PropertyBuilder => (QuickTipInfo(pb.Location, pb, manager))
- | tb is TypeBuilder => (QuickTipInfo(tb.Location, tb, manager))
| _ => (null)
}
}
@@ -181,8 +163,7 @@
typeDecl : Decl.Type,
fileIndex : int,
line : int,
- col : int,
- source : ISource
+ col : int
)
: list [GotoInfo]
{
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 Sun Nov 5 05:45:09 2006
@@ -76,12 +76,7 @@
/// Finds the innermost top level construction (namespace, class,
/// using, attribute) located at fileIndex, line, and col.
- public GetActiveDecl(
- fileIndex : int,
- line : int,
- col : int
- )
- : Decl
+ public GetActiveDecl(fileIndex : int, line : int, col : int) : Decl
{
def find_decl(decl : Decl)
{
@@ -116,13 +111,7 @@
GetActiveDecl(_compileUnits.GetFileIndex(filePath), line, col)
}
- public GetQuickTipInfo(
- [NotNull] filePath : string,
- line : int,
- col : int,
- [NotNull] source : ISource
- )
- : QuickTipInfo
+ public GetQuickTipInfo([NotNull] filePath : string, line : int, col : int) : QuickTipInfo
{
def fileIndex = _compileUnits.GetFileIndex(filePath);
def decl = GetActiveDecl(fileIndex, line, col);
@@ -130,26 +119,20 @@
match (decl)
{
| Using as us => GetUsingQuickTip(us, fileIndex, line, col)
- | Type as tp => GetTypeQuickTip (tp, fileIndex, line, col, source, _engine);
+ | Type as tp => GetTypeQuickTip (tp, fileIndex, line, col, _engine);
| None => throw System.Exception()
| _ => null
}
}
- public GetGotoInfo(
- [NotNull] filePath : string,
- line : int,
- col : int,
- [NotNull] source : ISource
- )
- : array [GotoInfo]
+ public GetGotoInfo([NotNull] filePath : string, line : int, col : int) : array [GotoInfo]
{
def fileIndex = _compileUnits.GetFileIndex(filePath);
def decl = GetActiveDecl(fileIndex, line, col);
match (decl)
{
- | Type as tp => GetTypeGoto(tp, fileIndex, line, col, source).ToArray();
+ | Type as tp => GetTypeGoto(tp, fileIndex, line, col).ToArray();
| None => throw System.Exception()
| _ => null
}
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.Properties.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.Properties.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.Properties.n Sun Nov 5 05:45:09 2006
@@ -1,7 +1,7 @@
using System;
using System.IO;
using System.Diagnostics;
-using SCG = System.Collections.Generic;
+
using Nemerle.Assertions;
using Nemerle.Collections;
using Nemerle.Compiler;
@@ -10,9 +10,10 @@
using Nemerle.Utility;
using Nemerle.Compiler.Utils;
-using Typed = Nemerle.Compiler.Typedtree;
-using SR = System.Reflection;
+using SCG = System.Collections.Generic;
+using SR = System.Reflection;
+using Typed = Nemerle.Compiler.Typedtree;
namespace Nemerle.Completion2
{
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 Sun Nov 5 05:45:09 2006
@@ -99,7 +99,7 @@
{
def file = FilePath1;
def (line, col) = ReadLocation(file, "Hint on return");
- def result = _project.GetQuickTipInfo(file, line, col, TestSourceTextManager(file));
+ def result = _project.GetQuickTipInfo(file, line, col);
Assert.IsNotNull(result, "result is null");
Assert.AreEqual (result.Text.Split('\n')[0], "macro Nemerle.Imperative.Return");
@@ -127,7 +127,7 @@
{
def file = FilePath1;
def (line, col) = ReadLocation(file, "Hint in body of implicit match");
- def result = _project.GetQuickTipInfo(file, line, col, TestSourceTextManager(file));
+ def result = _project.GetQuickTipInfo(file, line, col);
Assert.IsNotNull(result, "result is null");
//WriteLine(result.Text);
@@ -142,7 +142,7 @@
def Test()
{
- def result = _project.GetQuickTipInfo(file, line, col, TestSourceTextManager(file));
+ def result = _project.GetQuickTipInfo(file, line, col);
Assert.IsNotNull(result, "result is null");
WriteLine(result.Text);
@@ -379,7 +379,7 @@
def Test()
{
- def result = _project.GetQuickTipInfo(file, line, col, TestSourceTextManager(file));
+ def result = _project.GetQuickTipInfo(file, line, col);
Assert.IsNotNull(result, "result is null");
WriteLine(result.Text);
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Utils.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Utils.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Utils.n Sun Nov 5 05:45:09 2006
@@ -259,7 +259,9 @@
{
| tb is TypeBuilder =>
- GetActiveMember(tb, fileIndex, line, col) :: loop(tail)
+ def member = GetActiveMember(tb, fileIndex, line, col);
+
+ if (member == null) loop(tail) else member :: loop(tail)
| mb is MemberBuilder =>
Modified: vs-plugin/trunk/Nemerle.VsIntegration/Project/ProjectInfo.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/Project/ProjectInfo.cs (original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Project/ProjectInfo.cs Sun Nov 5 05:45:09 2006
@@ -361,7 +361,7 @@
{
ErrorHelper.ThrowIfPathNullOrEmpty(filePath, "filePath");
- QuickTipInfo info = Project.GetQuickTipInfo(filePath, line + 1, col + 1, source);
+ QuickTipInfo info = Project.GetQuickTipInfo(filePath, line + 1, col + 1);
if (info != null)
info.Text = info.Text.Replace(_projectLocation, "");
@@ -372,7 +372,7 @@
public GotoInfo[] GetGoto(string filePath, int line, int col, ISource source)
{
ErrorHelper.ThrowIfPathNullOrEmpty(filePath, "filePath");
- return Project.GetGotoInfo(filePath, line + 1, col + 1, source);
+ return Project.GetGotoInfo(filePath, line + 1, col + 1);
}
public NemerleMethods GetMethodTip(string filePath, int line, int col, ISource source)
More information about the svn
mailing list