rename PSI classes according to current terminology:

KtMultiDeclaration(Entry) -> KtDestructuringDeclaration(Entry)
KtFunctionLiteralExpression -> KtLambdaExpression
KtFunctionLiteralArgument -> KtLambdaArgument
KtDelegationSpecifierList -> KtSuperTypeList
KtDelegationSpecifier -> KtSuperTypeListEntry
KtDelegatorToSuperClass -> KtSuperTypeEntry
KtDelegatorToSuperCall -> KtSuperTypeCallEntry
KtDelegationByExpressionSpecifier ->KtDelegatedSuperTypeEntry
This commit is contained in:
Dmitry Jemerov
2015-12-09 19:30:38 +01:00
parent ef4b3c99f4
commit 009e3f9cd7
302 changed files with 1375 additions and 1391 deletions
@@ -170,9 +170,9 @@ class ExpectedInfos(
}
private fun calculateForFunctionLiteralArgument(expressionWithType: KtExpression): Collection<ExpectedInfo>? {
val functionLiteralArgument = expressionWithType.getParent() as? KtFunctionLiteralArgument
val functionLiteralArgument = expressionWithType.getParent() as? KtLambdaArgument
val callExpression = functionLiteralArgument?.getParent() as? KtCallExpression ?: return null
val literalArgument = callExpression.getFunctionLiteralArguments().firstOrNull() ?: return null
val literalArgument = callExpression.getLambdaArguments().firstOrNull() ?: return null
if (literalArgument.getArgumentExpression() != expressionWithType) return null
return calculateForArgument(callExpression, literalArgument)
}
@@ -228,7 +228,7 @@ class ExpectedInfos(
val arguments = call.getValueArguments().subList(0, argumentIndex)
override fun getValueArguments() = arguments
override fun getFunctionLiteralArguments() = emptyList<FunctionLiteralArgument>()
override fun getFunctionLiteralArguments() = emptyList<LambdaArgument>()
override fun getValueArgumentList() = null
}
@@ -276,7 +276,7 @@ class ExpectedInfos(
}
val argumentName = argument.getArgumentName()?.asName
val isFunctionLiteralArgument = argument is FunctionLiteralArgument
val isFunctionLiteralArgument = argument is LambdaArgument
val callType = call.callType
val isArrayAccess = callType == Call.CallType.ARRAY_GET_METHOD || callType == Call.CallType.ARRAY_SET_METHOD
@@ -471,7 +471,7 @@ class ExpectedInfos(
val functionLiteral = block.parent as? KtFunctionLiteral
if (functionLiteral != null) {
val literalExpression = functionLiteral.parent as KtFunctionLiteralExpression
val literalExpression = functionLiteral.parent as KtLambdaExpression
return calculate(literalExpression)
.mapNotNull { it.fuzzyType }
.filter { KotlinBuiltIns.isExactFunctionOrExtensionFunctionType(it.type) }
@@ -57,7 +57,7 @@ public fun Call.mapArgumentsToParameters(targetDescriptor: CallableDescriptor):
var positionalArgumentIndex: Int? = 0
for (argument in getValueArguments()) {
if (argument is FunctionLiteralArgument) {
if (argument is LambdaArgument) {
map[argument] = parameters.last()
}
else {
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.lexer.KtModifierKeywordToken
import org.jetbrains.kotlin.lexer.KtTokens
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.getFunctionLiteralArgumentName
import org.jetbrains.kotlin.psi.psiUtil.getLambdaArgumentName
import org.jetbrains.kotlin.psi.psiUtil.visibilityModifierType
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.OverridingUtil
@@ -44,16 +44,16 @@ public inline fun <reified T: PsiElement> PsiElement.replaced(newElement: T): T
@Suppress("UNCHECKED_CAST")
public fun <T: PsiElement> T.copied(): T = copy() as T
public fun KtFunctionLiteralArgument.moveInsideParentheses(bindingContext: BindingContext): KtCallExpression {
public fun KtLambdaArgument.moveInsideParentheses(bindingContext: BindingContext): KtCallExpression {
return moveInsideParenthesesAndReplaceWith(this.getArgumentExpression(), bindingContext)
}
public fun KtFunctionLiteralArgument.moveInsideParenthesesAndReplaceWith(
public fun KtLambdaArgument.moveInsideParenthesesAndReplaceWith(
replacement: KtExpression,
bindingContext: BindingContext
): KtCallExpression = moveInsideParenthesesAndReplaceWith(replacement, getFunctionLiteralArgumentName(bindingContext))
): KtCallExpression = moveInsideParenthesesAndReplaceWith(replacement, getLambdaArgumentName(bindingContext))
public fun KtFunctionLiteralArgument.moveInsideParenthesesAndReplaceWith(
public fun KtLambdaArgument.moveInsideParenthesesAndReplaceWith(
replacement: KtExpression,
functionLiteralArgumentName: Name?
): KtCallExpression {
@@ -68,7 +68,7 @@ public fun KtFunctionLiteralArgument.moveInsideParenthesesAndReplaceWith(
psiFactory.createArgument(replacement)
}
val functionLiteralArgument = newCallExpression.getFunctionLiteralArguments().firstOrNull()!!
val functionLiteralArgument = newCallExpression.getLambdaArguments().firstOrNull()!!
val valueArgumentList = newCallExpression.getValueArgumentList() ?: psiFactory.createCallArguments("()")
valueArgumentList.addArgument(argument)
@@ -84,14 +84,14 @@ public fun KtFunctionLiteralArgument.moveInsideParenthesesAndReplaceWith(
}
public fun KtCallExpression.moveFunctionLiteralOutsideParentheses() {
assert(getFunctionLiteralArguments().isEmpty())
assert(getLambdaArguments().isEmpty())
val argumentList = getValueArgumentList()!!
val argument = argumentList.getArguments().last()
val expression = argument.getArgumentExpression()!!
assert(expression.unpackFunctionLiteral() != null)
val dummyCall = KtPsiFactory(this).createExpressionByPattern("foo()$0:'{}'", expression) as KtCallExpression
val functionLiteralArgument = dummyCall.getFunctionLiteralArguments().single()
val functionLiteralArgument = dummyCall.getLambdaArguments().single()
this.add(functionLiteralArgument)
if (argumentList.getArguments().size() > 1) {
argumentList.removeArgument(argument)