C#: Extract extension types and members. Replacing invocations to static generated methods with invocation of extension type member.

This commit is contained in:
Michael Nebel
2026-02-04 15:57:16 +01:00
parent ab505e3281
commit edfdc9812f
8 changed files with 256 additions and 20 deletions

View File

@@ -23,7 +23,11 @@ namespace Semmle.Extraction.CSharp.Entities
? Symbol.ContainingType.GetSymbolLocation()
: BodyDeclaringSymbol.GetSymbolLocation();
public override bool NeedsPopulation => base.NeedsPopulation || IsCompilerGeneratedDelegate();
public override bool NeedsPopulation =>
(base.NeedsPopulation || IsCompilerGeneratedDelegate()) &&
// Exclude compiler-generated extension methods. A call to such a method
// is replaced by a call to the defining extension method.
!Symbol.IsCompilerGeneratedExtensionMethod();
public override void Populate(TextWriter trapFile)
{