Browse Source

remove ILocatable implementation from DebuggerTextOutput

newNRILSpyDebugger
Siegfried Pammer 12 years ago
parent
commit
fd65a7cd5f
  1. 12
      src/AddIns/DisplayBindings/ILSpyAddIn/DebuggerTextOutput.cs
  2. 5
      src/AddIns/DisplayBindings/ILSpyAddIn/ILSpyUnresolvedFile.cs

12
src/AddIns/DisplayBindings/ILSpyAddIn/DebuggerTextOutput.cs

@ -11,20 +11,16 @@ using Mono.Cecil;
namespace ICSharpCode.ILSpyAddIn namespace ICSharpCode.ILSpyAddIn
{ {
public sealed class DebugInfoTokenWriterDecorator : DecoratingTokenWriter, ILocatable public sealed class DebugInfoTokenWriterDecorator : DecoratingTokenWriter
{ {
readonly Stack<MethodDebugSymbols> symbolsStack = new Stack<MethodDebugSymbols>(); readonly Stack<MethodDebugSymbols> symbolsStack = new Stack<MethodDebugSymbols>();
readonly ILocatable locationProvider;
public readonly Dictionary<string, MethodDebugSymbols> DebugSymbols = new Dictionary<string, MethodDebugSymbols>(); public readonly Dictionary<string, MethodDebugSymbols> DebugSymbols = new Dictionary<string, MethodDebugSymbols>();
public readonly Dictionary<string, ICSharpCode.NRefactory.TextLocation> MemberLocations = new Dictionary<string, ICSharpCode.NRefactory.TextLocation>(); public readonly Dictionary<string, ICSharpCode.NRefactory.TextLocation> MemberLocations = new Dictionary<string, ICSharpCode.NRefactory.TextLocation>();
public DebugInfoTokenWriterDecorator(TokenWriter writer, ILocatable locationProvider) public DebugInfoTokenWriterDecorator(TokenWriter writer)
: base(writer) : base(writer)
{ {
if (locationProvider == null)
throw new ArgumentNullException("locationProvider");
this.locationProvider = locationProvider;
} }
public override void StartNode(AstNode node) public override void StartNode(AstNode node)
@ -61,9 +57,5 @@ namespace ICSharpCode.ILSpyAddIn
DebugSymbols[XmlDocKeyProvider.GetKey(symbols.CecilMethod)] = symbols; DebugSymbols[XmlDocKeyProvider.GetKey(symbols.CecilMethod)] = symbols;
} }
} }
public ICSharpCode.NRefactory.TextLocation Location {
get { return locationProvider.Location; }
}
} }
} }

5
src/AddIns/DisplayBindings/ILSpyAddIn/ILSpyUnresolvedFile.cs

@ -27,13 +27,12 @@ namespace ICSharpCode.ILSpyAddIn
{ {
var writer = new StringWriter(); var writer = new StringWriter();
var target = new TextWriterTokenWriter(writer) { IndentationString = "\t" }; var target = new TextWriterTokenWriter(writer) { IndentationString = "\t" };
var output = new DebugInfoTokenWriterDecorator(target, target); var output = new DebugInfoTokenWriterDecorator(TokenWriter.WrapInWriterThatSetsLocationsInAST(target));
builder.RunTransformations(); builder.RunTransformations();
var syntaxTree = builder.SyntaxTree; var syntaxTree = builder.SyntaxTree;
syntaxTree.AcceptVisitor(new InsertParenthesesVisitor { InsertParenthesesForReadability = true }); syntaxTree.AcceptVisitor(new InsertParenthesesVisitor { InsertParenthesesForReadability = true });
var outputFormatter = TokenWriter.WrapInWriterThatSetsLocationsInAST(output); syntaxTree.AcceptVisitor(new CSharpOutputVisitor(output, FormattingOptionsFactory.CreateSharpDevelop()));
syntaxTree.AcceptVisitor(new CSharpOutputVisitor(outputFormatter, FormattingOptionsFactory.CreateSharpDevelop()));
ILSpyUnresolvedFile file = new ILSpyUnresolvedFile(name, syntaxTree.Errors); ILSpyUnresolvedFile file = new ILSpyUnresolvedFile(name, syntaxTree.Errors);
builder.SyntaxTree.FileName = name.ToFileName(); builder.SyntaxTree.FileName = name.ToFileName();
var ts = syntaxTree.ToTypeSystem(); var ts = syntaxTree.ToTypeSystem();

Loading…
Cancel
Save