Ruby: Narrow memo method candidates earlier

This commit is contained in:
Harry Maclean
2022-05-23 13:05:26 +01:00
parent ef6f0e5b30
commit 457a84006c

View File

@@ -79,6 +79,7 @@ private predicate memoReturnedFromMethod(Method m, MemoStmt s) {
* This can cause stale or incorrect values to be returned when the method is called with different arguments.
*/
predicate isImproperMemoizationMethod(Method m, Parameter p, AssignLogicalOrExpr s) {
m instanceof MemoCandidate and
m.getName() != "initialize" and
parameterUsedInMemoValue(m, p, s) and
not parameterUsedInMemoKey(m, p, s) and