[svn] r6618: vs-plugin/trunk/Nemerle.Compiler.Utils:
Nemerle.Completion2/CodeModel/ExprFinder.n Nemerle.Co...
IT
svnadmin at nemerle.org
Wed Sep 6 01:36:01 CEST 2006
Log:
Quick tips outside the method body.
Author: IT
Date: Wed Sep 6 01:35:56 2006
New Revision: 6618
Modified:
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ExprFinder.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Type.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine-main.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Utils.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 Wed Sep 6 01:35:56 2006
@@ -21,7 +21,7 @@
mutable _pexprLocation : Location;
mutable _findLocation : bool;
- #region Find PExpr
+ //#region Find PExpr
DoSyntaxElement(syntaxElement : SyntaxElement) : void
{
@@ -236,9 +236,9 @@
(_retLocation, _retObject)
}
- #endregion
+ //#endregion
- #region Find TExpr
+ //#region Find TExpr
DoPattern(pattern : Pattern) : void
{
@@ -565,9 +565,9 @@
(_retLocation, _retObject)
}
- #endregion
+ //#endregion
- #region Helpers
+ //#region Helpers
Init(rootLocation : Location, line : int, col : int) : void
{
@@ -669,6 +669,6 @@
ignore(ex);
}
- #endregion
+ //#endregion
}
}
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 Wed Sep 6 01:35:56 2006
@@ -71,6 +71,7 @@
}
}
+ | null => array(0)
| _ => throw System.Exception($"Unknown member type '$member'.");
}
}
@@ -83,7 +84,14 @@
getText : GetText) : QuickTipInfo
{
def typeBuilder = typeDecl.Builder;
- def member = typeBuilder.GetActiveMember(fileIndex, line, col);
+ def members = typeBuilder.GetActiveMembers(fileIndex, line, col);
+
+ def member = match (members)
+ {
+ | [m] => m
+ | [] => null
+ | m :: tail => tail.FindWithDefault(m, (f) => f is PropertyBuilder);
+ }
match (member)
{
@@ -161,9 +169,10 @@
*/
null
}
- | tb is TypeBuilder =>
- Trace.Assert(false, $"TypeBuilder ($tb) not supported yet.");
- null
+
+ | fb is FieldBuilder => QuickTipInfo(fb.Location, fb)
+ | pb is PropertyBuilder => QuickTipInfo(pb.Location, pb)
+ | null => null
| _ =>
Trace.Assert(false, $"Unknown member type '$member'.");
throw System.Exception($"Unknown member type '$member'.");
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 Wed Sep 6 01:35:56 2006
@@ -204,6 +204,8 @@
pBody = method.GetHeader().body :> FunBody.Parsed;
+ when (pBody.expr != null)
+ {
try
{
method.RunBodyTyper();
@@ -213,6 +215,7 @@
{
| e => ex = e
}
+ }
(pBody, tBody, ex)
}
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 Wed Sep 6 01:35:56 2006
@@ -197,6 +197,50 @@
loop(members);
}
+ public GetActiveMembers(
+ this typeBuilder : TypeBuilder,
+ fileIndex : int,
+ line : int,
+ col : int)
+ : list[IMember]
+ {
+ def loop(members : list[IMember])
+ {
+ | member :: tail =>
+
+ match (member)
+ {
+ | tb is TypeBuilder =>
+
+ GetActiveMember(tb, fileIndex, line, col) :: loop(tail)
+
+ | mb is MemberBuilder =>
+
+ if (mb.Location.Contains(fileIndex, line, col) ||
+ mb.BodyLocation.Contains(fileIndex, line, col))
+ member :: loop(tail)
+ else
+ loop(tail)
+
+ | _ =>
+
+ if (member.Location.Contains(fileIndex, line, col))
+ member :: loop(tail)
+ else
+ loop(tail)
+
+ }
+ | [] => []
+ }
+
+ def members = typeBuilder.GetMembers(
+ BindingFlags.Static %| BindingFlags.Instance %|
+ BindingFlags.Public %| BindingFlags.NonPublic %|
+ BindingFlags.DeclaredOnly);
+
+ loop(members);
+ }
+
public Contains(this location : Location, testFileIndex : int,
testLine : int, testCol : int) : bool
{
More information about the svn
mailing list