@@ -10,7 +10,6 @@ class ArgumentPosition = DataFlowDispatch::ArgumentPosition;
10
10
11
11
// import all instances below
12
12
private module Summaries {
13
- private import semmle.code.csharp.dataflow.LibraryTypeDataFlow
14
13
private import semmle.code.csharp.frameworks.EntityFramework
15
14
}
16
15
@@ -111,6 +110,29 @@ module SummaryComponentStack {
111
110
112
111
class SummarizedCallable = Impl:: Public:: SummarizedCallable ;
113
112
113
+ private predicate recordConstructorFlow ( Constructor c , int i , Property p ) {
114
+ c = any ( Record r ) .getAMember ( ) and
115
+ exists ( string name |
116
+ c .getParameter ( i ) .getName ( ) = name and
117
+ c .getDeclaringType ( ) .getAMember ( name ) = p
118
+ )
119
+ }
120
+
121
+ private class RecordConstructorFlow extends SummarizedCallable {
122
+ RecordConstructorFlow ( ) { recordConstructorFlow ( this , _, _) }
123
+
124
+ override predicate propagatesFlow (
125
+ SummaryComponentStack input , SummaryComponentStack output , boolean preservesValue
126
+ ) {
127
+ exists ( int i , Property p |
128
+ recordConstructorFlow ( this , i , p ) and
129
+ input = SummaryComponentStack:: argument ( i ) and
130
+ output = SummaryComponentStack:: propertyOf ( p , SummaryComponentStack:: return ( ) ) and
131
+ preservesValue = true
132
+ )
133
+ }
134
+ }
135
+
114
136
private class SummarizedCallableDefaultClearsContent extends Impl:: Public:: SummarizedCallable {
115
137
SummarizedCallableDefaultClearsContent ( ) {
116
138
this instanceof Impl:: Public:: SummarizedCallable or none ( )
@@ -129,3 +151,17 @@ private class SummarizedCallableDefaultClearsContent extends Impl::Public::Summa
129
151
}
130
152
131
153
class RequiredSummaryComponentStack = Impl:: Public:: RequiredSummaryComponentStack ;
154
+
155
+ private class RecordConstructorFlowRequiredSummaryComponentStack extends RequiredSummaryComponentStack {
156
+ private SummaryComponent head ;
157
+
158
+ RecordConstructorFlowRequiredSummaryComponentStack ( ) {
159
+ exists ( Property p |
160
+ recordConstructorFlow ( _, _, p ) and
161
+ head = SummaryComponent:: property ( p ) and
162
+ this = SummaryComponentStack:: return ( )
163
+ )
164
+ }
165
+
166
+ override predicate required ( SummaryComponent c ) { c = head }
167
+ }
0 commit comments