DeprecatedSymbolUsageFix: keeping named arguments

This commit is contained in:
Valentin Kipyatkov
2015-05-22 16:23:17 +03:00
parent 0c397548e8
commit 2e2701aa61
7 changed files with 129 additions and 13 deletions
@@ -52,10 +52,14 @@ public object OptionalParametersHelper {
val arguments = resolvedCall.getCall().getValueArguments()
val argumentsToDrop = ArrayList<ValueArgument>()
//TODO: can drop arguments leaving last functional literal one (outside of parenthesis)
for (argument in arguments.reverse()) {
if (!canDrop(argument)) break // TODO: not correct because of named arguments
if (!argument.matchesDefault(resolvedCall, parameterToDefaultValue)) break // TODO: not correct because of named arguments
if (!canDrop(argument) || !argument.matchesDefault(resolvedCall, parameterToDefaultValue)) {
if (!argument.isNamed()) break else continue // for a named argument we can try to drop arguments before it as well
}
argumentsToDrop.add(argument)
}
return argumentsToDrop