PsiMethodCallExpression (@NotNull TerminalBlock terminalBlock, @NotNull PsiExpressionStatement additionToListStatement) { PsiMethodCallExpression additionToList = tryCast(additionToListStatement.getExpression(), PsiMethodCallExpression.class); if (!LIST_ADD.test(additionToList)) return null; PsiExpression[] additionArgs = additionToList.getArgumentList().getExpressions(); PsiExpression arg = additionArgs[0]; PsiReferenceExpression referenceExpression = tryCast(arg, PsiReferenceExpression.class); if (referenceExpression == null) return null; PsiVariable savedVar = tryCast(referenceExpression.resolve(), PsiVariable.class); if(savedVar == null) return null; if (!savedVar.equals(terminalBlock.getVariable())) return null; return additionToList; }