Move generation of fake call to common CodegenUtil to share between JS and JVM

This commit is contained in:
Alexey Andreev
2017-01-17 13:34:41 +03:00
parent c100826629
commit d261f8eddf
3 changed files with 13 additions and 26 deletions
@@ -16,6 +16,7 @@
package org.jetbrains.kotlin.backend.common
import com.intellij.openapi.project.Project
import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.backend.common.bridges.findInterfaceImplementation
import org.jetbrains.kotlin.descriptors.*
@@ -154,4 +155,12 @@ object CodegenUtil {
}
return this[slice, whenExpression] == true
}
@JvmStatic
fun constructFakeFunctionCall(project: Project, referencedFunction: FunctionDescriptor): KtCallExpression {
val fakeFunctionCall = StringBuilder("callableReferenceFakeCall(")
fakeFunctionCall.append(referencedFunction.valueParameters.map { "p${it.index}" }.joinToString(", "))
fakeFunctionCall.append(")")
return KtPsiFactory(project).createExpression(fakeFunctionCall.toString()) as KtCallExpression
}
}