@@ -64,19 +64,7 @@ deprecated class StringConstCompare extends DataFlow::BarrierGuard,
6464 // The value of the condition that results in the node being validated.
6565 private boolean checkedBranch ;
6666
67- StringConstCompare ( ) {
68- exists ( CfgNodes:: ExprNodes:: StringLiteralCfgNode strLitNode |
69- this .getExpr ( ) instanceof EqExpr and checkedBranch = true
70- or
71- this .getExpr ( ) instanceof CaseEqExpr and checkedBranch = true
72- or
73- this .getExpr ( ) instanceof NEExpr and checkedBranch = false
74- |
75- this .getLeftOperand ( ) = strLitNode and this .getRightOperand ( ) = checkedNode
76- or
77- this .getLeftOperand ( ) = checkedNode and this .getRightOperand ( ) = strLitNode
78- )
79- }
67+ StringConstCompare ( ) { stringConstCompare ( this , checkedNode , checkedBranch ) }
8068
8169 override predicate checks ( CfgNode expr , boolean branch ) {
8270 expr = checkedNode and branch = checkedBranch
@@ -138,15 +126,7 @@ deprecated class StringConstArrayInclusionCall extends DataFlow::BarrierGuard,
138126 CfgNodes:: ExprNodes:: MethodCallCfgNode {
139127 private CfgNode checkedNode ;
140128
141- StringConstArrayInclusionCall ( ) {
142- this .getMethodName ( ) = "include?" and
143- this .getArgument ( 0 ) = checkedNode and
144- exists ( ExprNodes:: ArrayLiteralCfgNode arr | isArrayConstant ( this .getReceiver ( ) , arr ) |
145- forall ( ExprCfgNode elem | elem = arr .getAnArgument ( ) |
146- elem instanceof ExprNodes:: StringLiteralCfgNode
147- )
148- )
149- }
129+ StringConstArrayInclusionCall ( ) { stringConstArrayInclusionCall ( this , checkedNode , _) }
150130
151131 override predicate checks ( CfgNode expr , boolean branch ) { expr = checkedNode and branch = true }
152132}
0 commit comments