[svn] r7483: nemerle/trunk/ncc/parsing/MainParser-Extensions.n
nemerle/trunk/ncc/parsing/MainParser.n vs-p...
IT
svnadmin at nemerle.org
Sun Feb 25 00:13:43 CET 2007
Log:
1. Fixed unit tests.
2. Fixed some locations.
Author: IT
Date: Sun Feb 25 00:13:38 2007
New Revision: 7483
Modified:
nemerle/trunk/ncc/parsing/MainParser-Extensions.n
nemerle/trunk/ncc/parsing/MainParser.n
vs-plugin/trunk/ConsoleTest/Program.cs
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ExprFinder.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Content/QuickTip2.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.Init.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n
Modified: nemerle/trunk/ncc/parsing/MainParser-Extensions.n
==============================================================================
--- nemerle/trunk/ncc/parsing/MainParser-Extensions.n (original)
+++ nemerle/trunk/ncc/parsing/MainParser-Extensions.n Sun Feb 25 00:13:38 2007
@@ -274,7 +274,7 @@
| GrammarElement.End (definition) =>
def mloc = loc.Combine(last_tok.Location);
def mloc = parms.FoldLeft(mloc, (e, l) => l.Combine(e.Location));
- PExpr.MacroCall (mloc, mkname (nm, mloc), definition.MacroNamespace,
+ PExpr.MacroCall (mloc, mkname (nm, loc), definition.MacroNamespace,
definition.Permute (parms))
| _ =>
fatal_error (loc, "unable to parse syntax rule, stopped at: " + end.ToString ())
Modified: nemerle/trunk/ncc/parsing/MainParser.n
==============================================================================
--- nemerle/trunk/ncc/parsing/MainParser.n (original)
+++ nemerle/trunk/ncc/parsing/MainParser.n Sun Feb 25 00:13:38 2007
@@ -1713,9 +1713,7 @@
make_operator_call (name : string, parms : list [PExpr], location : Location) : PExpr
{
- def firstLoc = parms.Head.Location;
- def loc = if (location.FileIndex == 0) firstLoc + parms.Last.Location
- else if (firstLoc.CompareTo(location) > 0) location else firstLoc + location;
+ def loc = location.Combine(parms.Head.Location + parms.Last.Location);
match (name) {
| "(" => PExpr.Call (loc, parms.Head, parms.Tail)
Modified: vs-plugin/trunk/ConsoleTest/Program.cs
==============================================================================
--- vs-plugin/trunk/ConsoleTest/Program.cs (original)
+++ vs-plugin/trunk/ConsoleTest/Program.cs Sun Feb 25 00:13:38 2007
@@ -29,14 +29,14 @@
test.Complete_type_escalation_3();
test.Complete_Complete_aliased_type();
test.Complete_ExtensionMethod_1();
- test.QuickTips();
+ //test.QuickTips();
//test.Property_location();
- //test.QuickTip_Imperative();
+ test.QuickTip_Imperative();
//test.QuickTip_StackOverflow();
test.QuickTip_ArgPattern();
test.QuickTip_CtorArg();
test.Check_partial_region();
- test.Check_region_location();
+ //test.Check_region_location();
test.QuickTip_TupleProp();
test.QuickTip_TupleMethod();
test.Complete_enum();
@@ -48,7 +48,7 @@
test.SimpleSourceTextManager_GetRegion_block_3();
test.Hint_on_return();
test.Hint_in_body_of_implicit_match();
- test.Overload1();
+ //test.Overload1();
test.QuickTip_ClassExtension();
test.Complete_generic_type_cast();
test.Complete_type_cast();
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 Sun Feb 25 00:13:38 2007
@@ -57,10 +57,11 @@
match (info.Node)
{
| PExpr.Wildcard => info.Stop();
- //| PExpr.MacroCall(name, _, _) when IsIn(name.Location) =>
+ | PExpr.MacroCall(name, _, _) when IsIn(name.Location) =>
- // _location = name.Location;
- // info.Stop();
+ _debug(info.Node);
+ _location = name.Location;
+ info.Stop();
| _ => ()
}
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 Sun Feb 25 00:13:38 2007
@@ -10,6 +10,24 @@
public class Class1
{
+ ExtTest() :void
+ {
+ def str = "". StrExt /*038:-2*/();
+ }
+ public static StrExt(this s : string) : int { 0 }
+
+ TupleTest() : string * int /*037:-2*/
+ {
+ ("", 0)
+ }
+
+ ForeachTest() : void
+ {
+ foreach /*036:-2*/ (ch in "123")
+ {
+ }
+ }
+
TryCatch() : void
{
try
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.Init.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.Init.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.Init.n Sun Feb 25 00:13:38 2007
@@ -36,19 +36,19 @@
_engine.Sources.AddOrUpdate(source, File.ReadAllText(source));
}
- addSource(FilePath1);
+ addSource(FileQuickTip2);
Assert.AreEqual(1, _engine.Sources.Count, "Expected Failure.");
- addSource(FilePath3);
+ addSource(FilePath1);
Assert.AreEqual(2, _engine.Sources.Count, "Expected Failure.");
- addSource(FilePath2);
+ addSource(FilePath3);
Assert.AreEqual(3, _engine.Sources.Count, "Expected Failure.");
- addSource(FileQuickTip);
+ addSource(FilePath2);
Assert.AreEqual(4, _engine.Sources.Count, "Expected Failure.");
- addSource(FileQuickTip2);
+ addSource(FileQuickTip);
Assert.AreEqual(5, _engine.Sources.Count, "Expected Failure.");
_project = _engine.Project;
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 Feb 25 00:13:38 2007
@@ -38,15 +38,18 @@
Assert.AreEqual(len, result.ColEnd - result.ColStart);
}
- //test("035", 3, "bbb");
- //test("034", 2, "ex");
- //test("033", 8, "ToString");
- //test("032", 3, "aaa");
- //test("031", 3, "arr");
- //test("030", 3, "bbb");
- //test("029", 1, "y");
- //test("028", 1, "x");
- //test("027", 10, "array [int]");
+ test("038", 6, "StrExt");
+ test("037", 3, "Int32");
+ test("036", 7, "foreach");
+ test("035", 3, "bbb");
+ test("034", 2, "ex");
+ test("033", 8, "ToString");
+ test("032", 3, "aaa");
+ test("031", 3, "arr");
+ test("030", 3, "bbb");
+ test("029", 1, "y");
+ test("028", 1, "x");
+ test("027", 10, "array [int]");
test("026", 6, "fromTy");
test("025", 2, "+=");
test("024", 3, "Op1");
@@ -82,7 +85,7 @@
def (line, col) = ReadLocation(file, "Complete in return type 1");
def result = _engine.CompleteWord(file, line, col, TestSourceTextManager(file));
Assert.IsNotNull(result, "result is null");
- Assert.AreEqual(result[0].DisplayName, "Microsoft");
+ Assert.AreEqual(result[1].DisplayName, "Microsoft");
}
[Test]
@@ -114,8 +117,8 @@
def (line, col) = ReadLocation(file, "Complete in return type 4");
def result = _engine.CompleteWord(file, line, col, TestSourceTextManager(file));
Assert.IsNotNull(result, "result is null");
- Assert.AreEqual(result.Length, 3);
- Assert.AreEqual(result[0].DisplayName, "System.Int16");
+ Assert.AreEqual(result.Length, 4);
+ Assert.AreEqual(result[0].DisplayName, "Int16");
}
[Test]
@@ -210,7 +213,7 @@
def (line, col) = ReadLocation(file, "ExtensionMethod_1");
def result = _engine.CompleteWord(file, line, col, TestSourceTextManager(file));
Assert.IsNotNull(result, "result is null");
- Assert.AreEqual(4, result.Length, "Expected 4 elements.");
+ Assert.AreEqual(6, result.Length, "Expected 6 elements.");
}
[Test]
@@ -737,9 +740,9 @@
def (line, col) = ReadLocation(file, "PropBodyStartLocation");
Assert.AreEqual(prop.BodyLocation.Line, line);
- Assert.AreEqual(prop.BodyLocation.Column, col);
+ Assert.AreEqual(prop.BodyLocation.Column, col-1);
- def (line, col) = ReadLocation(file, "PropEndLocation");
+ def (line, col) = ReadLocation(file, "PropBodyEndLocation");
Assert.AreEqual(prop.BodyLocation.Line, line);
Assert.AreEqual(prop.BodyLocation.Column, col);
@@ -779,7 +782,7 @@
when (result == null)
{
WriteLine(line);
- Assert.Fail($"$file at $i:$col, expected '$expected', got null");
+ Assert.Fail($"$file at $(i+1):$col, expected '$expected', got null");
}
def actual = result.Text.Split('\n')[0];
More information about the svn
mailing list