Browse Source

Highlighting goto references.

pull/275/head
Artur Zgodziński 14 years ago
parent
commit
31b1a2dac9
  1. 17
      ICSharpCode.Decompiler/Ast/TextOutputFormatter.cs
  2. 2
      ILSpy/TextView/DecompilerTextView.cs

17
ICSharpCode.Decompiler/Ast/TextOutputFormatter.cs

@ -86,6 +86,15 @@ namespace ICSharpCode.Decompiler.Ast @@ -86,6 +86,15 @@ namespace ICSharpCode.Decompiler.Ast
// return variable.OriginalVariable;
return variable;
}
var gotoStatement = node as GotoStatement;
if (gotoStatement != null)
{
var method = nodeStack.Select(nd => nd.Annotation<MethodReference>()).FirstOrDefault(mr => mr != null);
if (method != null)
return method.ToString() + gotoStatement.Label;
}
return null;
}
@ -109,6 +118,14 @@ namespace ICSharpCode.Decompiler.Ast @@ -109,6 +118,14 @@ namespace ICSharpCode.Decompiler.Ast
}
}
var label = node as LabelStatement;
if (label != null)
{
var method = nodeStack.Select(nd => nd.Annotation<MethodReference>()).FirstOrDefault(mr => mr != null);
if (method != null)
return method.ToString() + label.Label;
}
return null;
}

2
ILSpy/TextView/DecompilerTextView.cs

@ -617,7 +617,7 @@ namespace ICSharpCode.ILSpy.TextView @@ -617,7 +617,7 @@ namespace ICSharpCode.ILSpy.TextView
ClearLocalReferenceMarks();
if (references != null) {
foreach (var r in references) {
if (r.Reference == reference) {
if (reference.Equals(r.Reference)) {
var mark = textMarkerService.Create(r.StartOffset, r.Length);
mark.BackgroundColor = r.IsLocalTarget ? Colors.LightSeaGreen : Colors.GreenYellow;
localReferenceMarks.Add(mark);

Loading…
Cancel
Save