@@ -1148,17 +1148,10 @@ private module Cached {
1148
1148
p .getCallable ( ) instanceof PrimaryConstructor
1149
1149
} or
1150
1150
TCapturedVariableContent ( VariableCapture:: CapturedVariable v ) or
1151
- TDelegateCallArgumentContent ( Parameter p , int i ) {
1152
- i =
1153
- [ 0 .. p .getType ( )
1154
- .getUnboundDeclaration ( )
1155
- .( SystemLinqExpressions:: DelegateExtType )
1156
- .getDelegateType ( )
1157
- .getNumberOfParameters ( ) - 1 ]
1151
+ TDelegateCallArgumentContent ( int i ) {
1152
+ i = [ 0 .. max ( int j | j = any ( DelegateCall dc ) .getNumberOfArguments ( ) ) ]
1158
1153
} or
1159
- TDelegateCallReturnContent ( Parameter p ) {
1160
- p .getType ( ) .getUnboundDeclaration ( ) instanceof SystemLinqExpressions:: DelegateExtType
1161
- }
1154
+ TDelegateCallReturnContent ( )
1162
1155
1163
1156
cached
1164
1157
newtype TContentSet =
@@ -1175,12 +1168,8 @@ private module Cached {
1175
1168
firstChar = approximatePrimaryConstructorParameterContent ( _)
1176
1169
} or
1177
1170
TCapturedVariableContentApprox ( VariableCapture:: CapturedVariable v ) or
1178
- TDelegateCallArgumentApproxContent ( string firstChar ) {
1179
- firstChar = approximateDelegateCallArgumentContent ( _)
1180
- } or
1181
- TDelegateCallReturnApproxContent ( string firstChar ) {
1182
- firstChar = approximateDelegateCallReturnContent ( _)
1183
- }
1171
+ TDelegateCallArgumentApproxContent ( ) or
1172
+ TDelegateCallReturnApproxContent ( )
1184
1173
1185
1174
pragma [ nomagic]
1186
1175
private predicate commonSubTypeGeneral ( DataFlowTypeOrUnifiable t1 , RelevantGvnType t2 ) {
@@ -2296,14 +2285,13 @@ private predicate recordProperty(RecordType t, ContentSet c, string name) {
2296
2285
* the content set `c` of a delegate call.
2297
2286
*
2298
2287
* If there is a delegate call f(x), then we store "x" on "f"
2299
- * using a delegate parameter content set.
2288
+ * using a delegate argument content set.
2300
2289
*/
2301
2290
private predicate storeStepDelegateCall ( Node node1 , ContentSet c , Node node2 ) {
2302
- exists ( DelegateCall call , Parameter p , int i |
2291
+ exists ( DelegateCall call , int i |
2303
2292
node1 .asExpr ( ) = call .getArgument ( i ) and
2304
2293
node2 .( PostUpdateNode ) .getPreUpdateNode ( ) .asExpr ( ) = call .getExpr ( ) and
2305
- call .getExpr ( ) = p .getAnAccess ( ) and
2306
- c .isDelegateCallArgument ( p , i )
2294
+ c .isDelegateCallArgument ( i )
2307
2295
)
2308
2296
}
2309
2297
@@ -2465,15 +2453,14 @@ private predicate readContentStep(Node node1, Content c, Node node2) {
2465
2453
* Holds if data can flow from `node1` to `node2` via an assignment to
2466
2454
* the content set `c` of a delegate call.
2467
2455
*
2468
- * If there is a delegate call f(x), then we read the result of the delegate
2456
+ * If there is a delegate call f(x), then we read the return of the delegate
2469
2457
* call.
2470
2458
*/
2471
2459
private predicate readStepDelegateCall ( Node node1 , ContentSet c , Node node2 ) {
2472
- exists ( DelegateCall call , Parameter p |
2460
+ exists ( DelegateCall call |
2473
2461
node1 .asExpr ( ) = call .getExpr ( ) and
2474
2462
node2 .asExpr ( ) = call and
2475
- call .getExpr ( ) = p .getAnAccess ( ) and
2476
- c .isDelegateCallReturn ( p )
2463
+ c .isDelegateCallReturn ( )
2477
2464
)
2478
2465
}
2479
2466
@@ -3092,15 +3079,11 @@ class ContentApprox extends TContentApprox {
3092
3079
this = TCapturedVariableContentApprox ( v ) and result = "captured " + v
3093
3080
)
3094
3081
or
3095
- exists ( string firstChar |
3096
- this = TDelegateCallArgumentApproxContent ( firstChar ) and
3097
- result = "approximated delegate call argument " + firstChar
3098
- )
3082
+ this = TDelegateCallArgumentApproxContent ( ) and
3083
+ result = "approximated delegate call argument"
3099
3084
or
3100
- exists ( string firstChar |
3101
- this = TDelegateCallReturnApproxContent ( firstChar ) and
3102
- result = "approximated delegate call return " + firstChar
3103
- )
3085
+ this = TDelegateCallReturnApproxContent ( ) and
3086
+ result = "approximated delegate call return"
3104
3087
}
3105
3088
}
3106
3089
@@ -3122,22 +3105,6 @@ private string approximatePrimaryConstructorParameterContent(PrimaryConstructorP
3122
3105
result = pc .getParameter ( ) .getName ( ) .prefix ( 1 )
3123
3106
}
3124
3107
3125
- private string getApproximateParameterName ( Parameter p ) {
3126
- exists ( string name | name = p .getName ( ) |
3127
- name = "" and result = ""
3128
- or
3129
- result = name .prefix ( 1 )
3130
- )
3131
- }
3132
-
3133
- private string approximateDelegateCallArgumentContent ( DelegateCallArgumentContent dc ) {
3134
- result = getApproximateParameterName ( dc .getParameter ( ) )
3135
- }
3136
-
3137
- private string approximateDelegateCallReturnContent ( DelegateCallReturnContent dc ) {
3138
- result = getApproximateParameterName ( dc .getParameter ( ) )
3139
- }
3140
-
3141
3108
/** Gets an approximated value for content `c`. */
3142
3109
pragma [ nomagic]
3143
3110
ContentApprox getContentApprox ( Content c ) {
@@ -3154,9 +3121,11 @@ ContentApprox getContentApprox(Content c) {
3154
3121
or
3155
3122
result = TCapturedVariableContentApprox ( VariableCapture:: getCapturedVariableContent ( c ) )
3156
3123
or
3157
- result = TDelegateCallArgumentApproxContent ( approximateDelegateCallArgumentContent ( c ) )
3124
+ c instanceof DelegateCallArgumentContent and
3125
+ result = TDelegateCallArgumentApproxContent ( )
3158
3126
or
3159
- result = TDelegateCallReturnApproxContent ( approximateDelegateCallReturnContent ( c ) )
3127
+ c instanceof DelegateCallReturnContent and
3128
+ result = TDelegateCallReturnApproxContent ( )
3160
3129
}
3161
3130
3162
3131
/**
0 commit comments