Skip to content

Commit e69f0e3

Browse files
committed
C#: Don't generate stubs for the record Clone method.
1 parent f6af593 commit e69f0e3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

csharp/extractor/Semmle.Extraction.CSharp.StubGenerator/StubVisitor.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,9 @@ private void StubParameters(ICollection<IParameterSymbol> parameters)
557557
});
558558
}
559559

560+
private static bool ExcludeMethod(IMethodSymbol symbol) =>
561+
symbol.Name == "<Clone>$";
562+
560563
private void StubMethod(IMethodSymbol symbol, IMethodSymbol? explicitInterfaceSymbol, IMethodSymbol? baseCtor)
561564
{
562565
var methodKind = explicitInterfaceSymbol is null ? symbol.MethodKind : explicitInterfaceSymbol.MethodKind;
@@ -568,7 +571,7 @@ private void StubMethod(IMethodSymbol symbol, IMethodSymbol? explicitInterfaceSy
568571
MethodKind.Ordinary
569572
};
570573

571-
if (!relevantMethods.Contains(methodKind))
574+
if (!relevantMethods.Contains(methodKind) || ExcludeMethod(symbol))
572575
return;
573576

574577
StubAttributes(symbol.GetAttributes());

0 commit comments

Comments
 (0)