[svn] r6835: vs-plugin/trunk: ConsoleTest/Program.cs
Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Eng...
VladD2
svnadmin at nemerle.org
Sun Nov 5 14:54:23 CET 2006
Log:
1. Add exception handing in Engine.PreParseMethodBody() (incremental parsing).
2. Add test (completion of enum fields).
3. Add clear compiler messages on Check().
Author: VladD2
Date: Sun Nov 5 14:54:20 2006
New Revision: 6835
Modified:
vs-plugin/trunk/ConsoleTest/Program.cs
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine-main.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Content/Class1.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Utils.n
Modified: vs-plugin/trunk/ConsoleTest/Program.cs
==============================================================================
--- vs-plugin/trunk/ConsoleTest/Program.cs (original)
+++ vs-plugin/trunk/ConsoleTest/Program.cs Sun Nov 5 14:54:20 2006
@@ -12,6 +12,7 @@
Test1 test = new Test1();
test.Init();
+ test.Complete_enum();
test.SimpleSourceTextManager_GetLine();
test.SimpleSourceTextManager_GetLine_EOF();
test.SimpleSourceTextManager_GetLineAndColumn();
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 Sun Nov 5 14:54:20 2006
@@ -210,14 +210,34 @@
protected override PreParseMethodBody (method : MethodBuilder) : Token.BracesGroup
{
+ def reportError(e, msg)
+ {
+ Trace.WriteLine($"$msg method body of:");
+ Trace.WriteLine($"\t$method");
+ Trace.WriteLine($"\tfailed.");
+ Trace.WriteLine($"\tError: $(e.Message)");
+ }
+
def loc = method.BodyLocation;
+ def bodyCode = try
+ {
def filePath = loc.File;
def source = ProjectSources.GetSource(filePath);
- def bodyCode = source.GetRegion(loc);
+ source.GetRegion(loc);
+ }
+ catch { e => reportError(e, "Try get"); "{}" } // return empty body!
+ try
+ {
def lexer = LexerString(this, bodyCode, loc);
def preparser = PreParser(lexer);
preparser.PreParse()
}
+ catch
+ { e =>
+ reportError(e, "Try compile");
+ Token.BracesGroup(null)
+ } // return empty body!
+ }
} // end class Engine
} // end namespace
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Content/Class1.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Content/Class1.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Content/Class1.n Sun Nov 5 14:54:20 2006
@@ -96,7 +96,7 @@
return/*Hint on return:-1*/;
}
- public Method12(x : bool) : void
+ public Method13(x : bool) : void
{
/*Start block 1:-0*/;
/*End block 1:0*/
@@ -110,6 +110,11 @@
/*End block 3:0*/
}
+ public Method14() : void
+ {
+ System.AttributeTargets./*Complete enum:-0*/
+ }
+
xxx : TestVariant2;
}
}
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 14:54:20 2006
@@ -14,6 +14,16 @@
public partial class Test1
{
[Test]
+ public Complete_enum() : void
+ {
+ def file = FilePath1;
+ def (line, col) = ReadLocation(file, "Complete enum");
+ def result = _project.CompleteWord(file, line, col, TestSourceTextManager(file));
+ Assert.IsNotNull(result, "result is null");
+ Assert.AreEqual(26, result.Length, "Expected 26 elements.");
+ }
+
+ [Test]
public SimpleSourceTextManager_GetLine() : void
{
def file = FilePath1;
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 14:54:20 2006
@@ -18,12 +18,6 @@
: PExpr * TExpr * Exception
{
(method.BodyParsed, method.BodyTyped, null)
- //def loc = method.BodyLocation;
- //def filePath = loc.File;
- //def engine = method.Manager :> Engine;
- //def source = engine.ProjectSources.GetSource(filePath);
- //def bodyCode = source.GetRegion(loc.Line, loc.Column, loc.EndLine, loc.EndColumn);
- //engine.CompileMethod(method, bodyCode, loc);
}
public IsNullOrEmpty(this value : string) : bool
More information about the svn
mailing list