[svn]
r7465: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2:
CodeModel/Project.Type.n CodeMode...
IT
svnadmin at nemerle.org
Thu Feb 22 17:15:39 CET 2007
Log:
Implemented FindObject for function parameters.
Author: IT
Date: Thu Feb 22 17:15:36 2007
New Revision: 7465
Modified:
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Type.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/QuickTipInfo.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Content/QuickTip2.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.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 Thu Feb 22 17:15:36 2007
@@ -153,14 +153,25 @@
}
else
{
- def parms = ast.header.parms;
-
- match (parms.Find(p => p.ty.Location.Contains(line, col)))
+ def getParam(pparms, tparms)
{
- | Some(p) => checkType(p.ty, method.Header.parms.Nth(parms.IndexOf(p)).ty)
- | _ => (Location.Default, null, null)
+ match (pparms)
+ {
+ | [] => (Location.Default, null, null)
+ | p :: _ =>
+
+ if (p.name.Location.Contains(line, col))
+ (p.name.Location, p.name, tparms.Head)
+ else if (p.ty.Location.Contains(line, col))
+ checkType(p.ty, tparms.Head.ty)
+ else
+ getParam(pparms.Tail, tparms.Tail)
+
}
}
+
+ getParam(ast.header.parms, method.Header.parms);
+ }
}
else
{
@@ -280,6 +291,7 @@
| tv is TyVar => (QuickTipInfo(loc, tv))
| tc is TExpr.ImplicitValueTypeCtor => (QuickTipInfo(loc, tc.ty))
| fh is Typedtree.Fun_header => (QuickTipInfo(loc, fh))
+ | fp is Typedtree.Fun_parm => (QuickTipInfo(loc, fp))
| p is Pattern.Enum => (QuickTipInfo(loc, p.fld, manager))
| null => (null)
#if DEBUG
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/QuickTipInfo.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/QuickTipInfo.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/QuickTipInfo.n Thu Feb 22 17:15:36 2007
@@ -66,6 +66,12 @@
_text += ") : " + fh.ret_type.ToDisplayString();
}
+ public this(location : Location, parm : Typedtree.Fun_parm)
+ {
+ SetLocation(location);
+ _text = $"(function parameter) $(parm.name) : $(parm.ty)";
+ }
+
public this(location : Location, me : TExpr.MacroEnvelope)
{
SetLocation(location);
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Content/QuickTip2.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Content/QuickTip2.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Content/QuickTip2.n Thu Feb 22 17:15:36 2007
@@ -10,7 +10,7 @@
public class Class1
{
- ParamTest(arr : array[int]) : void
+ ParamTest( arr /*031:-2*/ : array[int]) : void
{
def bar(bbb /*030:-2*/: array[int] /*027:-2*/) {}
bar(arr);
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 Thu Feb 22 17:15:36 2007
@@ -38,6 +38,7 @@
Assert.AreEqual(len, result.ColEnd - result.ColStart);
}
+ test("031", 3, "arr");
test("030", 3, "bbb");
test("029", 1, "y");
test("028", 1, "x");
More information about the svn
mailing list