From 143663b0f3b3788b4d2dd60dc1242342cb5bf1a1 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sat, 8 Sep 2012 10:40:01 +0200 Subject: [PATCH] Fix navigating to methods in DecompiledViewContent. --- .../ILSpyAddIn/ViewContent/DecompiledViewContent.cs | 5 +++-- .../ICSharpCode.Decompiler/Ast/TextOutputFormatter.cs | 10 +++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/AddIns/DisplayBindings/ILSpyAddIn/ViewContent/DecompiledViewContent.cs b/src/AddIns/DisplayBindings/ILSpyAddIn/ViewContent/DecompiledViewContent.cs index eb9efb465f..f8839d943a 100644 --- a/src/AddIns/DisplayBindings/ILSpyAddIn/ViewContent/DecompiledViewContent.cs +++ b/src/AddIns/DisplayBindings/ILSpyAddIn/ViewContent/DecompiledViewContent.cs @@ -13,6 +13,7 @@ using ICSharpCode.Decompiler.Ast; using ICSharpCode.ILSpyAddIn.LaunchILSpy; using ICSharpCode.ILSpyAddIn.ViewContent; using ICSharpCode.NRefactory; +using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.SharpDevelop; using ICSharpCode.SharpDevelop.Bookmarks; using ICSharpCode.SharpDevelop.Debugging; @@ -47,7 +48,7 @@ namespace ICSharpCode.ILSpyAddIn #region Constructor public DecompiledViewContent(FileName assemblyFile, string fullTypeName, string entityTag) { - this.virtualFileName = FileName.Create("ilspy://" + assemblyFile + ">" + fullTypeName); + this.virtualFileName = FileName.Create("ilspy://" + assemblyFile + "/" + fullTypeName); this.codeView = new CodeView(); this.assemblyFile = assemblyFile; @@ -55,7 +56,7 @@ namespace ICSharpCode.ILSpyAddIn this.jumpToEntityIdStringWhenDecompilationFinished = entityTag; string shortTypeName = fullTypeName.Substring(fullTypeName.LastIndexOf('.') + 1); - this.TitleName = "[" + shortTypeName + "]"; + this.TitleName = "[" + ReflectionHelper.SplitTypeParameterCountFromReflectionName(shortTypeName) + "]"; Thread thread = new Thread(DecompilationThread); thread.Name = "Decompiler (" + shortTypeName + ")"; diff --git a/src/Libraries/ICSharpCode.Decompiler/Ast/TextOutputFormatter.cs b/src/Libraries/ICSharpCode.Decompiler/Ast/TextOutputFormatter.cs index 5e3cef9947..c43b0c7c25 100644 --- a/src/Libraries/ICSharpCode.Decompiler/Ast/TextOutputFormatter.cs +++ b/src/Libraries/ICSharpCode.Decompiler/Ast/TextOutputFormatter.cs @@ -150,13 +150,11 @@ namespace ICSharpCode.Decompiler.Ast return null; var node = nodeStack.Peek(); + if (node is Identifier) + node = node.Parent; if (IsDefinition(node)) return node.Annotation(); - var fieldDef = node.Parent.Annotation(); - if (fieldDef != null) - return node.Parent.Annotation(); - return null; } @@ -332,7 +330,9 @@ namespace ICSharpCode.Decompiler.Ast private static bool IsDefinition(AstNode node) { - return node is EntityDeclaration; + return node is EntityDeclaration + || (node is VariableInitializer && node.Parent is FieldDeclaration) + || node is FixedVariableInitializer; } } }