diff --git a/Disasmo/Utils/SymbolUtils.cs b/Disasmo/Utils/SymbolUtils.cs index 295116f..3ab8128 100644 --- a/Disasmo/Utils/SymbolUtils.cs +++ b/Disasmo/Utils/SymbolUtils.cs @@ -27,7 +27,16 @@ public static DisasmoSymbolInfo FromSymbol(ISymbol symbol) if (symbol is IMethodSymbol ms) { - if (ms.MethodKind == MethodKind.LocalFunction) + if (ms.MethodKind == MethodKind.LambdaMethod) + { + // hack for lambdas + target = prefix + ":*"; + if (symbol.ContainingSymbol is IMethodSymbol { MethodKind: MethodKind.Ordinary } ps) + target += ps.MetadataName + "*"; + hostType = symbol.ContainingType.ToString(); + methodName = "*"; + } + else if (ms.MethodKind == MethodKind.LocalFunction) { // hack for mangled names target = prefix + ":*" + symbol.MetadataName + "*"; diff --git a/src/Vsix/Analyzers/DisasmMethodOrClassAction.cs b/src/Vsix/Analyzers/DisasmMethodOrClassAction.cs index 5d46061..d0e7998 100644 --- a/src/Vsix/Analyzers/DisasmMethodOrClassAction.cs +++ b/src/Vsix/Analyzers/DisasmMethodOrClassAction.cs @@ -59,6 +59,8 @@ protected override async Task IsValidSymbol(Document document, int tokenPo return true; if (token.Parent is OperatorDeclarationSyntax) return true; + if (token.Parent is AnonymousFunctionExpressionSyntax) + return true; } catch (Exception exc) { @@ -70,6 +72,9 @@ protected override async Task IsValidSymbol(Document document, int tokenPo static ISymbol FindRelatedSymbol(SemanticModel semanticModel, SyntaxNode node, bool allowClassesAndStructs, CancellationToken ct) { + if (node is AnonymousFunctionExpressionSyntax af) + return semanticModel.GetDeclaredSymbol(af, ct); + if (node is LocalFunctionStatementSyntax lf) return semanticModel.GetDeclaredSymbol(lf, ct);