private void flushForeachLoopVariable(@Nullable GrForClause clause) { if (clause instanceof GrForInClause) { GrVariable variable = clause.getDeclaredVariable(); if (variable != null && myPolicy.isVariableInitialized(variable)) { addNodeAndCheckPending( new ReadWriteVariableInstruction(variable.getName(), variable, WRITE)); } } }
public void visitVariable(GrVariable variable) { super.visitVariable(variable); if (myPolicy.isVariableInitialized(variable)) { ReadWriteVariableInstruction writeInst = new ReadWriteVariableInstruction(variable.getName(), variable, WRITE); addNodeAndCheckPending(writeInst); } }
private static boolean variablesAreEquivalent( @NotNull GrVariable var1, @NotNull GrVariable var2) { final GrExpression initializer1 = (GrExpression) var1.getInitializer(); final GrExpression initializer2 = (GrExpression) var2.getInitializer(); if (!expressionsAreEquivalent(initializer1, initializer2)) { return false; } final PsiType type1 = var1.getType(); final PsiType type2 = var2.getType(); if (!typesAreEquivalent(type1, type2)) { return false; } final String name1 = var1.getName(); final String name2 = var2.getName(); if (name1 == null) { return name2 == null; } return name1.equals(name2); }