From e4b15256ababf09b6bcf18fd04705de5aef7d771 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sat, 3 Aug 2019 20:48:56 +0200 Subject: [PATCH] #1025: Fix method groups not being clickable. --- ICSharpCode.Decompiler/CSharp/Annotations.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ICSharpCode.Decompiler/CSharp/Annotations.cs b/ICSharpCode.Decompiler/CSharp/Annotations.cs index ea813e554..28edfe0bb 100644 --- a/ICSharpCode.Decompiler/CSharp/Annotations.cs +++ b/ICSharpCode.Decompiler/CSharp/Annotations.cs @@ -19,6 +19,7 @@ using System; using System.Collections.Generic; using System.Linq; +using ICSharpCode.Decompiler.CSharp.Resolver; using ICSharpCode.Decompiler.CSharp.Syntax; using ICSharpCode.Decompiler.IL; using ICSharpCode.Decompiler.Semantics; @@ -104,7 +105,17 @@ namespace ICSharpCode.Decompiler.CSharp public static ISymbol GetSymbol(this AstNode node) { var rr = node.Annotation(); - return rr != null ? rr.GetSymbol() : null; + if (rr is MethodGroupResolveResult) { + // delegate construction? + var newObj = node.Annotation(); + var funcptr = newObj?.Arguments.ElementAtOrDefault(1); + if (funcptr is LdFtn ldftn) { + return ldftn.Method; + } else if (funcptr is LdVirtFtn ldVirtFtn) { + return ldVirtFtn.Method; + } + } + return rr?.GetSymbol(); } ///