File tree Expand file tree Collapse file tree 2 files changed +24
-12
lines changed
csharp/ql/lib/semmle/code/csharp Expand file tree Collapse file tree 2 files changed +24
-12
lines changed Original file line number Diff line number Diff line change @@ -398,6 +398,15 @@ private module Gvn {
398
398
)
399
399
}
400
400
401
+ pragma [ noinline]
402
+ private predicate toStringPart ( int i , int j ) {
403
+ exists ( Unification:: GenericType t , int children |
404
+ t = this .getConstructedGenericDeclaringTypeAt ( i ) and
405
+ children = t .getNumberOfArgumentsSelf ( ) and
406
+ if children = 0 then j = 0 else j in [ 0 .. 2 * children ]
407
+ )
408
+ }
409
+
401
410
language [ monotonicAggregates]
402
411
string toString ( ) {
403
412
this .isFullyConstructed ( ) and
@@ -406,11 +415,7 @@ private module Gvn {
406
415
or
407
416
result =
408
417
strictconcat ( int i , int j |
409
- exists ( Unification:: GenericType t , int children |
410
- t = this .getConstructedGenericDeclaringTypeAt ( i ) and
411
- children = t .getNumberOfArgumentsSelf ( ) and
412
- if children = 0 then j = 0 else j in [ 0 .. 2 * children ]
413
- )
418
+ this .toStringPart ( i , j )
414
419
|
415
420
this .toStringConstructedPart ( i , j ) order by i desc , j
416
421
)
Original file line number Diff line number Diff line change @@ -277,20 +277,27 @@ module Gvn {
277
277
)
278
278
}
279
279
280
+ pragma [ noinline]
281
+ private predicate toStringPart ( int i , int j ) {
282
+ exists ( int offset |
283
+ exists ( GenericType t , int children |
284
+ t = this .getConstructedGenericDeclaringTypeAt ( i ) and
285
+ children = t .getNumberOfArgumentsSelf ( ) and
286
+ ( if this .isDeclaringTypeAt ( i ) then offset = 1 else offset = 0 ) and
287
+ if children = 0 then j in [ 0 .. offset ] else j in [ 0 .. 2 * children + offset ]
288
+ )
289
+ )
290
+ }
291
+
280
292
language [ monotonicAggregates]
281
293
string toString ( ) {
282
294
this .isFullyConstructed ( ) and
283
295
exists ( CompoundTypeKind k | k = this .getKind ( ) |
284
296
result = k .toStringBuiltin ( this .getArg ( 0 ) .toString ( ) )
285
297
or
286
298
result =
287
- strictconcat ( int i , int j , int offset |
288
- exists ( GenericType t , int children |
289
- t = this .getConstructedGenericDeclaringTypeAt ( i ) and
290
- children = t .getNumberOfArgumentsSelf ( ) and
291
- ( if this .isDeclaringTypeAt ( i ) then offset = 1 else offset = 0 ) and
292
- if children = 0 then j in [ 0 .. offset ] else j in [ 0 .. 2 * children + offset ]
293
- )
299
+ strictconcat ( int i , int j |
300
+ toStringPart ( i , j )
294
301
|
295
302
this .toStringConstructedPart ( i , j ) order by i desc , j
296
303
)
You can’t perform that action at this time.
0 commit comments