PsiElement (PsiStatement loopStatement, PsiVariable var, PsiExpression initializer, String replacement, InitializerUsageStatus status, CommentTracker ct) { if (status == ControlFlowUtils.InitializerUsageStatus.DECLARED_JUST_BEFORE) { ct.replace(initializer, replacement); removeLoop(ct, loopStatement); return var; } else { if (status == ControlFlowUtils.InitializerUsageStatus.AT_WANTED_PLACE_ONLY) { PsiTypeElement typeElement = var.getTypeElement(); if (typeElement == null || !typeElement.isInferredType() || PsiTypesUtil.replaceWithExplicitType(typeElement) != null) { ct.delete(initializer); } } return ct.replaceAndRestoreComments(loopStatement, var.getName() + " = " + replacement + ";"); } }