@@ -4,7 +4,6 @@ private import dotnet
44private import DataFlowImplCommon as DataFlowImplCommon
55private import DataFlowPublic
66private import DataFlowPrivate
7- private import semmle.code.csharp.controlflow.internal.Splitting
87private import FlowSummaryImpl as FlowSummaryImpl
98private import semmle.code.csharp.dataflow.FlowSummary as FlowSummary
109private import semmle.code.csharp.dataflow.ExternalFlow
@@ -22,7 +21,13 @@ private import semmle.code.csharp.frameworks.system.collections.Generic
2221 */
2322DotNet:: Callable getCallableForDataFlow ( DotNet:: Callable c ) {
2423 exists ( DotNet:: Callable unboundDecl | unboundDecl = c .getUnboundDeclaration ( ) |
25- result .hasBody ( ) and
24+ (
25+ result .hasBody ( )
26+ or
27+ // take synthesized bodies into account, e.g. implicit constructors
28+ // with field initializer assignments
29+ result = any ( ControlFlow:: Nodes:: ElementNode n ) .getEnclosingCallable ( )
30+ ) and
2631 if unboundDecl .getFile ( ) .fromSource ( )
2732 then
2833 // C# callable with C# implementation in the database
@@ -40,16 +45,6 @@ DotNet::Callable getCallableForDataFlow(DotNet::Callable c) {
4045 // C# callable without C# implementation in the database
4146 unboundDecl .matchesHandle ( result .( CIL:: Callable ) )
4247 )
43- or
44- result = c .getUnboundDeclaration ( ) and
45- isDefaultConstructorWithMemberInit ( result )
46- }
47-
48- private predicate isDefaultConstructorWithMemberInit ( InstanceConstructor c ) {
49- c .isUnboundDeclaration ( ) and
50- c .getFile ( ) .fromSource ( ) and
51- not c .hasBody ( ) and
52- InitializerSplitting:: constructorInitializes ( c , _)
5348}
5449
5550/**
0 commit comments