Ruby: filter out obvious module 'prepend' calls

This commit is contained in:
Asger F
2022-10-02 12:15:58 +02:00
parent 00e52ad109
commit fd9c1e4507

View File

@@ -1142,7 +1142,12 @@ module Array {
this = mc.getMethodName() + "(" + mc.getNumberOfArguments() + ")"
}
override MethodCall getACallSimple() { result = mc }
override MethodCall getACallSimple() {
result = mc and
// Filter out obvious 'prepend' calls in a module scope
// Including such calls is mostly harmless but also easy to filter out
not result.getReceiver().(SelfVariableAccess).getCfgScope() instanceof ModuleBase
}
override predicate propagatesFlowExt(string input, string output, boolean preservesValue) {
exists(int num | num = mc.getNumberOfArguments() and preservesValue = true |