mirror of
https://github.com/github/codeql.git
synced 2026-04-29 18:55:14 +02:00
C#: Use containing type instead of containing method in local function TRAP label
This is in order to handle the case where the enclosing callable of a local function is a lambda expression.
This commit is contained in:
@@ -11,17 +11,11 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
{
|
||||
}
|
||||
|
||||
Method ContainingMethod =>
|
||||
symbol.OriginalDefinition.ContainingSymbol is IMethodSymbol m
|
||||
? Method.Create(Context, m)
|
||||
: throw new InternalError(symbol, "Unable to determine local function's containing callable");
|
||||
|
||||
public override void WriteId(TextWriter trapFile)
|
||||
{
|
||||
trapFile.WriteSubId(ContainingMethod);
|
||||
trapFile.Write(".(");
|
||||
trapFile.WriteSubId(ContainingType);
|
||||
trapFile.Write(".");
|
||||
trapFile.WriteSubId(Location);
|
||||
trapFile.Write(')');
|
||||
if (symbol.IsGenericMethod && !IsSourceDeclaration)
|
||||
{
|
||||
trapFile.Write('<');
|
||||
|
||||
Reference in New Issue
Block a user