@@ -4,7 +4,6 @@ private import dotnet
4
4
private import DataFlowImplCommon as DataFlowImplCommon
5
5
private import DataFlowPublic
6
6
private import DataFlowPrivate
7
- private import semmle.code.csharp.controlflow.internal.Splitting
8
7
private import FlowSummaryImpl as FlowSummaryImpl
9
8
private import semmle.code.csharp.dataflow.FlowSummary as FlowSummary
10
9
private import semmle.code.csharp.dataflow.ExternalFlow
@@ -22,7 +21,13 @@ private import semmle.code.csharp.frameworks.system.collections.Generic
22
21
*/
23
22
DotNet:: Callable getCallableForDataFlow ( DotNet:: Callable c ) {
24
23
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
26
31
if unboundDecl .getFile ( ) .fromSource ( )
27
32
then
28
33
// C# callable with C# implementation in the database
@@ -40,16 +45,6 @@ DotNet::Callable getCallableForDataFlow(DotNet::Callable c) {
40
45
// C# callable without C# implementation in the database
41
46
unboundDecl .matchesHandle ( result .( CIL:: Callable ) )
42
47
)
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 , _)
53
48
}
54
49
55
50
/**
0 commit comments