int (PsiElement[] elements, PsiVariable variable) { int result = -1; final int statementsLength = elements.length; for (int i = 0; i < statementsLength; i++) { final PsiElement element = elements[i]; if (isAssignmentToVariable(element, variable)) { if (result >= 0) { return -1; } result = i; } else if (VariableAccessUtils.variableIsAssigned(variable, element)) { return -1; } } return result; }