DeprecatedSymbolUsageFix: handling of array access expression duplication

This commit is contained in:
Valentin Kipyatkov
2015-05-26 17:44:00 +03:00
parent d5d1158e44
commit 18c19457f0
@@ -279,13 +279,11 @@ public abstract class DeprecatedSymbolUsageFixBase(
is JetStringTemplateExpression -> getEntries().any { if (sideEffectOnly) it.getExpression().shouldKeepValue(usageCount) else it is JetStringTemplateEntryWithExpression }
is JetThisExpression, is JetSuperExpression, is JetConstantExpression -> false
is JetParenthesizedExpression -> getExpression().shouldKeepValue(usageCount)
// TODO: discuss it
is JetArrayAccessExpression -> if (sideEffectOnly) getArrayExpression().shouldKeepValue(usageCount) || getIndexExpressions().any { it.shouldKeepValue(usageCount) } else true
is JetBinaryExpression -> if (sideEffectOnly) getLeft().shouldKeepValue(usageCount) || getRight().shouldKeepValue(usageCount) else true
is JetIfExpression -> if (sideEffectOnly) getCondition().shouldKeepValue(usageCount) || getThen().shouldKeepValue(usageCount) || getElse().shouldKeepValue(usageCount) else true
is JetBinaryExpressionWithTypeRHS -> true
else -> true // what else it can be?
else -> true
}
}