@@ -25,20 +25,19 @@ class RecursionSource extends MethodCall {
2525 override string toString ( ) {
2626 result = this .getCaller ( ) .toString ( ) + " clls " + this .getCallee ( ) .toString ( )
2727 }
28-
2928}
3029
3130/**
3231 * Check if the Expr uses directly an argument of the enclosing function
3332 */
3433class ParameterOperation extends Expr {
3534 ParameterOperation ( ) {
36- this instanceof BinaryExpr or this instanceof UnaryAssignExpr
37- and exists (
38- VarAccess va |
39- va .getVariable ( ) = this .getEnclosingCallable ( ) .getAParameter ( ) |
40- this .getAChildExpr + ( ) = va
41- )
35+ this instanceof BinaryExpr
36+ or
37+ this instanceof UnaryAssignExpr and
38+ exists ( VarAccess va | va .getVariable ( ) = this .getEnclosingCallable ( ) .getAParameter ( ) |
39+ this .getAChildExpr + ( ) = va
40+ )
4241 }
4342}
4443
@@ -57,25 +56,24 @@ module RecursiveConfig implements DataFlow::StateConfigSig {
5756 }
5857
5958 predicate isBarrier ( DataFlow:: Node node ) {
60- exists ( MethodCall ma |
61- ma = node .asExpr ( )
62- and (
63- exists ( Expr e | e = ma .getAnArgument ( ) and e instanceof ParameterOperation )
64- // or exists(
65- // VarAccess e|
66- // e = ma.getAnArgument() |
67- // e.getVariable().getAnAssignedValue().getAChildExpr() instanceof ParameterOperation
68- // )
69- )
59+ exists ( MethodCall ma |
60+ ma = node .asExpr ( ) and
61+ exists ( Expr e | e = ma .getAnArgument ( ) and e instanceof ParameterOperation )
62+ // or exists(
63+ // VarAccess e|
64+ // e = ma.getAnArgument() |
65+ // e.getVariable().getAnAssignedValue().getAChildExpr() instanceof ParameterOperation
66+ // )
7067 )
7168 }
7269
7370 /**
7471 * Weird but useful deduplication logic
7572 */
7673 predicate isBarrierIn ( DataFlow:: Node node , FlowState state ) {
77- not node .asExpr ( ) instanceof MethodCall
78- or node .asExpr ( ) .( MethodCall ) .getCaller ( ) .getLocation ( ) .getStartLine ( ) > state .getLocation ( ) .getStartLine ( )
74+ not node .asExpr ( ) instanceof MethodCall or
75+ node .asExpr ( ) .( MethodCall ) .getCaller ( ) .getLocation ( ) .getStartLine ( ) >
76+ state .getLocation ( ) .getStartLine ( )
7977 }
8078}
8179
@@ -93,4 +91,4 @@ import RecursiveFlow::PathGraph
9391from RecursiveFlow:: PathNode source , RecursiveFlow:: PathNode sink
9492where RecursiveFlow:: flowPath ( source , sink )
9593// TODO(dm): de-duplicate results
96- select sink .getNode ( ) , source , sink , "Found a recursion: "
94+ select sink .getNode ( ) , source , sink , "Found a recursion: "
0 commit comments