[Monodevelop-patches-list] r2397 - in trunk/MonoDevelop/Core/src/ICSharpCode.SharpRefactory: . src src/Parser/AST src/PrettyPrinter
John Luke <jluke@cfl.rr.com>
jluke at mono-cvs.ximian.com
Sat Mar 26 16:05:10 EST 2005
Author: jluke
Date: 2005-03-26 16:05:10 -0500 (Sat, 26 Mar 2005)
New Revision: 2397
Modified:
trunk/MonoDevelop/Core/src/ICSharpCode.SharpRefactory/ChangeLog
trunk/MonoDevelop/Core/src/ICSharpCode.SharpRefactory/src/Main.cs
trunk/MonoDevelop/Core/src/ICSharpCode.SharpRefactory/src/Parser/AST/AbstractASTVisitor.cs
trunk/MonoDevelop/Core/src/ICSharpCode.SharpRefactory/src/Parser/AST/IASTVisitor.cs
trunk/MonoDevelop/Core/src/ICSharpCode.SharpRefactory/src/PrettyPrinter/PrettyPrintVisitor.cs
Log:
make it easier to report errors during the visitor pass
Modified: trunk/MonoDevelop/Core/src/ICSharpCode.SharpRefactory/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/ICSharpCode.SharpRefactory/ChangeLog 2005-03-26 20:44:14 UTC (rev 2396)
+++ trunk/MonoDevelop/Core/src/ICSharpCode.SharpRefactory/ChangeLog 2005-03-26 21:05:10 UTC (rev 2397)
@@ -1,5 +1,12 @@
2005-03-26 John Luke <john.luke at gmail.com>
+ * src/PrettyPrinter/PrettyPrintVisitor.cs
+ * src/Parser/AST/AbstractASTVisitor.cs
+ * src/Parser/AST/IASTVisitor.cs: add Errors to AbstractASTVisitor
+ so we can report more errors correctly
+
+2005-03-26 John Luke <john.luke at gmail.com>
+
* Makefile.am: clean up test and add errors and tests
target to run both positive and negative tests.
* src/Main.cs: simplify and dont use PrettyPrintVisitor
Modified: trunk/MonoDevelop/Core/src/ICSharpCode.SharpRefactory/src/Main.cs
===================================================================
--- trunk/MonoDevelop/Core/src/ICSharpCode.SharpRefactory/src/Main.cs 2005-03-26 20:44:14 UTC (rev 2396)
+++ trunk/MonoDevelop/Core/src/ICSharpCode.SharpRefactory/src/Main.cs 2005-03-26 21:05:10 UTC (rev 2397)
@@ -38,8 +38,14 @@
static void PrintDir (DirectoryInfo dir)
{
- foreach (FileInfo fi in dir.GetFiles ())
+ if (dir.Name.StartsWith ("."))
+ return;
+ Console.WriteLine ("entering {0}", dir.Name);
+ foreach (FileInfo fi in dir.GetFiles ("*.cs"))
PrintFile (fi);
+
+ foreach (DirectoryInfo di in dir.GetDirectories ())
+ PrintDir (di);
}
static Parser p;
Modified: trunk/MonoDevelop/Core/src/ICSharpCode.SharpRefactory/src/Parser/AST/AbstractASTVisitor.cs
===================================================================
--- trunk/MonoDevelop/Core/src/ICSharpCode.SharpRefactory/src/Parser/AST/AbstractASTVisitor.cs 2005-03-26 20:44:14 UTC (rev 2396)
+++ trunk/MonoDevelop/Core/src/ICSharpCode.SharpRefactory/src/Parser/AST/AbstractASTVisitor.cs 2005-03-26 21:05:10 UTC (rev 2397)
@@ -6,6 +6,7 @@
{
public abstract class AbstractASTVisitor : IASTVisitor
{
+ Errors errors = new Errors ();
protected Stack blockStack = new Stack();
public BlockStatement CurrentBlock {
@@ -16,6 +17,11 @@
return (BlockStatement)blockStack.Peek();
}
}
+
+ public Errors Errors {
+ get { return errors; }
+ set { errors = value; }
+ }
#region ICSharpCode.SharpRefactory.Parser.IASTVisitor interface implementation
public virtual object Visit(INode node, object data)
Modified: trunk/MonoDevelop/Core/src/ICSharpCode.SharpRefactory/src/Parser/AST/IASTVisitor.cs
===================================================================
--- trunk/MonoDevelop/Core/src/ICSharpCode.SharpRefactory/src/Parser/AST/IASTVisitor.cs 2005-03-26 20:44:14 UTC (rev 2396)
+++ trunk/MonoDevelop/Core/src/ICSharpCode.SharpRefactory/src/Parser/AST/IASTVisitor.cs 2005-03-26 21:05:10 UTC (rev 2397)
@@ -5,6 +5,12 @@
{
public interface IASTVisitor
{
+ // Errors
+ Errors Errors {
+ get;
+ set;
+ }
+
object Visit(INode node, object data);
object Visit(CompilationUnit compilationUnit, object data);
Modified: trunk/MonoDevelop/Core/src/ICSharpCode.SharpRefactory/src/PrettyPrinter/PrettyPrintVisitor.cs
===================================================================
--- trunk/MonoDevelop/Core/src/ICSharpCode.SharpRefactory/src/PrettyPrinter/PrettyPrintVisitor.cs 2005-03-26 20:44:14 UTC (rev 2396)
+++ trunk/MonoDevelop/Core/src/ICSharpCode.SharpRefactory/src/PrettyPrinter/PrettyPrintVisitor.cs 2005-03-26 21:05:10 UTC (rev 2397)
@@ -27,7 +27,6 @@
{
public class PrettyPrintVisitor : AbstractASTVisitor
{
- Errors errors = new Errors();
OutputFormatter outputFormatter;
PrettyPrintOptions prettyPrintOptions = new PrettyPrintOptions();
@@ -37,12 +36,6 @@
}
}
- public Errors Errors {
- get {
- return errors;
- }
- }
-
public PrettyPrintOptions PrettyPrintOptions {
get {
return prettyPrintOptions;
@@ -56,7 +49,7 @@
public override object Visit(INode node, object data)
{
- errors.Error(-1, -1, String.Format("Visited INode (should NEVER HAPPEN)"));
+ Errors.Error(-1, -1, String.Format("Visited INode (should NEVER HAPPEN)"));
Console.WriteLine("Visitor was: " + this.GetType());
Console.WriteLine("Node was : " + node.GetType());
return node.AcceptChildren(this, data);
More information about the Monodevelop-patches-list
mailing list