Skip to content

Commit

Permalink
FindNodeByPath: Use metadata token as identification of member/type t…
Browse files Browse the repository at this point in the history
…ree nodes.
  • Loading branch information
siegfriedpammer committed Feb 27, 2020
1 parent df84ab8 commit 46bb042
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ILSpy/TextView/DecompilerTextView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ public void ShowNodes(AvalonEditTextOutput textOutput, ILSpyTreeNode[] nodes, IH
this.nextDecompilationRun = null;
}
if (nodes != null && string.IsNullOrEmpty(textOutput.Title))
textOutput.Title = string.Join(", ", nodes.Select(n => n.ToString()));
textOutput.Title = string.Join(", ", nodes.Select(n => n.Text));
ShowOutput(textOutput, highlighting);
decompiledNodes = nodes;
}
Expand Down Expand Up @@ -772,7 +772,7 @@ void DecompileNodes(DecompilationContext context, ITextOutput textOutput)
{
var nodes = context.TreeNodes;
if (textOutput is ISmartTextOutput smartTextOutput) {
smartTextOutput.Title = string.Join(", ", nodes.Select(n => n.ToString()));
smartTextOutput.Title = string.Join(", ", nodes.Select(n => n.Text));
}
for (int i = 0; i < nodes.Length; i++) {
if (i > 0)
Expand Down
6 changes: 6 additions & 0 deletions ILSpy/TreeNodes/EventTreeNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,11 @@ public override bool IsPublicAPI {
}

IEntity IMemberTreeNode.Member => EventDefinition;

public override string ToString()
{
int token = System.Reflection.Metadata.Ecma335.MetadataTokens.GetToken(EventDefinition.MetadataToken);
return "@" + token.ToString("X8");
}
}
}
6 changes: 6 additions & 0 deletions ILSpy/TreeNodes/FieldTreeNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,11 @@ public override bool IsPublicAPI {
}

IEntity IMemberTreeNode.Member => FieldDefinition;

public override string ToString()
{
int token = System.Reflection.Metadata.Ecma335.MetadataTokens.GetToken(FieldDefinition.MetadataToken);
return "@" + token.ToString("X8");
}
}
}
6 changes: 6 additions & 0 deletions ILSpy/TreeNodes/MethodTreeNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,11 @@ public override bool IsPublicAPI {
}

IEntity IMemberTreeNode.Member => MethodDefinition;

public override string ToString()
{
int token = System.Reflection.Metadata.Ecma335.MetadataTokens.GetToken(MethodDefinition.MetadataToken);
return "@" + token.ToString("X8");
}
}
}
6 changes: 6 additions & 0 deletions ILSpy/TreeNodes/PropertyTreeNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,11 @@ public override bool IsPublicAPI {
}

IEntity IMemberTreeNode.Member => PropertyDefinition;

public override string ToString()
{
int token = System.Reflection.Metadata.Ecma335.MetadataTokens.GetToken(PropertyDefinition.MetadataToken);
return "@" + token.ToString("X8");
}
}
}
6 changes: 6 additions & 0 deletions ILSpy/TreeNodes/TypeTreeNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,5 +154,11 @@ static AccessOverlayIcon GetOverlayIcon(ITypeDefinition type)
}

IEntity IMemberTreeNode.Member => TypeDefinition;

public override string ToString()
{
int token = System.Reflection.Metadata.Ecma335.MetadataTokens.GetToken(TypeDefinition.MetadataToken);
return "@" + token.ToString("X8");
}
}
}

0 comments on commit 46bb042

Please sign in to comment.