Ruby: simplify predicate by using DataFlow::CallNode

This commit is contained in:
Nick Rolfe
2022-04-19 11:27:33 +01:00
parent ca4dc0583d
commit ac805f0cdc

View File

@@ -124,9 +124,9 @@ predicate removesFirstOccurence(StringSubstitutionCall sub, string str) {
* Gets a method call where the receiver is the result of a string substitution * Gets a method call where the receiver is the result of a string substitution
* call. * call.
*/ */
DataFlow::Node getAMethodCall(StringSubstitutionCall call) { DataFlow::CallNode getAMethodCall(StringSubstitutionCall call) {
exists(DataFlow::Node receiver | exists(DataFlow::Node receiver |
receiver.asExpr() = result.asExpr().(ExprNodes::MethodCallCfgNode).getReceiver() and receiver = result.getReceiver() and
( (
// for a non-destructive string substitution, is there flow from it to the // for a non-destructive string substitution, is there flow from it to the
// receiver of another method call? // receiver of another method call?