@@ -397,8 +397,7 @@ module Filters {
397
397
/**
398
398
* Holds if `n` is a post-update node for `self` in method `m`.
399
399
*/
400
- predicate selfPostUpdate ( DataFlow:: PostUpdateNode n , Method m ) {
401
- n .getPreUpdateNode ( ) .asExpr ( ) instanceof SelfVariableAccessCfgNode and
400
+ private predicate selfPostUpdate ( DataFlow:: PostUpdateNode n , Method m ) {
402
401
m = n .getPreUpdateNode ( ) .asExpr ( ) .getExpr ( ) .getEnclosingCallable ( ) and
403
402
n .getPreUpdateNode ( )
404
403
.asExpr ( )
@@ -408,24 +407,6 @@ module Filters {
408
407
.getDeclaringScope ( ) = m
409
408
}
410
409
411
- /**
412
- * Holds if `n` is the syntactically last dataflow node in `m` that satisfies `selfPostUpdate`.
413
- * In the example below, `n` is the post-update node for `bar`.
414
- * ```rb
415
- * def m
416
- * foo
417
- * bar
418
- * end
419
- * ```
420
- */
421
- predicate lastSelfPostUpdate ( DataFlow:: PostUpdateNode n , Method m ) {
422
- selfPostUpdate ( n , m ) and
423
- not exists ( DataFlow:: PostUpdateNode n2 |
424
- selfPostUpdate ( n2 , m ) and
425
- n .getPreUpdateNode ( ) .asExpr ( ) .getASuccessor + ( ) = n2 .getPreUpdateNode ( ) .asExpr ( )
426
- )
427
- }
428
-
429
410
/**
430
411
* Holds if `n` is the self parameter of method `m`.
431
412
*/
@@ -444,34 +425,31 @@ module Filters {
444
425
* part of the callback chain.
445
426
*/
446
427
override predicate step ( DataFlow:: Node pred , DataFlow:: Node succ ) {
447
- exists ( Method predMethod , Method succMethod |
448
- next ( predMethod , succMethod ) and
449
- (
450
- // Flow from a post-update node of self in `pred` to the self parameter of `succ`
451
- //
452
- // def a
453
- // foo() ---------+
454
- // @x = 1 ---+ |
455
- // end | |
456
- // | |
457
- // def b <----+----+
458
- // ...
459
- //
460
- selfPostUpdate ( pred , predMethod ) and
461
- selfParameter ( succ , succMethod )
462
- or
463
- // Flow from the self parameter of `pred` to the self parameter of `succ`
464
- //
465
- // def a ---+
466
- // ... |
467
- // end |
468
- // |
469
- // def b <-+
470
- // ...
471
- //
472
- selfParameter ( pred , predMethod ) and
473
- selfParameter ( succ , succMethod )
474
- )
428
+ exists ( Method predMethod , Method succMethod | next ( predMethod , succMethod ) |
429
+ // Flow from a post-update node of self in `pred` to the self parameter of `succ`
430
+ //
431
+ // def a
432
+ // foo() ---------+
433
+ // @x = 1 ---+ |
434
+ // end | |
435
+ // | |
436
+ // def b <----+----+
437
+ // ...
438
+ //
439
+ selfPostUpdate ( pred , predMethod ) and
440
+ selfParameter ( succ , succMethod )
441
+ or
442
+ // Flow from the self parameter of `pred` to the self parameter of `succ`
443
+ //
444
+ // def a ---+
445
+ // ... |
446
+ // end |
447
+ // |
448
+ // def b <-+
449
+ // ...
450
+ //
451
+ selfParameter ( pred , predMethod ) and
452
+ selfParameter ( succ , succMethod )
475
453
)
476
454
}
477
455
}
0 commit comments