Rename ExpressionLambda to PsiExpressionLambda

This commit is contained in:
Mikhael Bogdanov
2017-06-21 13:45:45 +02:00
parent 0e2bd46124
commit 54dc828c8e
3 changed files with 8 additions and 5 deletions
@@ -698,7 +698,7 @@ class PsiInlineCodegen(
override fun putClosureParametersOnStack(next: LambdaInfo, functionReferenceReceiver: StackValue?) {
activeLambda = next
when (next) {
is ExpressionLambda -> codegen.pushClosureOnStack(next.classDescriptor, true, this, functionReferenceReceiver)
is PsiExpressionLambda -> codegen.pushClosureOnStack(next.classDescriptor, true, this, functionReferenceReceiver)
is DefaultLambda -> rememberCapturedForDefaultLambda(next)
else -> throw RuntimeException("Unknown lambda: $next")
}
@@ -744,7 +744,7 @@ class PsiInlineCodegen(
val ktLambda = KtPsiUtil.deparenthesize(expression)
assert(isInlinableParameterExpression(ktLambda)) { "Couldn't find inline expression in ${expression.text}" }
return ExpressionLambda(
return PsiExpressionLambda(
ktLambda!!, typeMapper, parameter.isCrossinline, getBoundCallableReferenceReceiver(expression) != null
).also { lambda ->
val closureInfo = invocationParamBuilder.addNextValueParameter(type, true, null, parameter.index)
@@ -176,12 +176,14 @@ class DefaultLambda(
fun Type.boxReceiverForBoundReference() = AsmUtil.boxType(this)
class ExpressionLambda(
abstract class ExpressionLambda(isCrossInline: Boolean): LambdaInfo(isCrossInline)
class PsiExpressionLambda(
expression: KtExpression,
private val typeMapper: KotlinTypeMapper,
isCrossInline: Boolean,
override val isBoundCallableReference: Boolean
) : LambdaInfo(isCrossInline) {
) : ExpressionLambda(isCrossInline) {
override val lambdaClassType: Type
@@ -136,6 +136,7 @@ class PsiSourceCompilerForInline(private val codegen: ExpressionCodegen, overrid
override fun generateLambdaBody(adapter: MethodVisitor,
jvmMethodSignature: JvmMethodSignature,
lambdaInfo: ExpressionLambda): SMAP {
lambdaInfo as? PsiExpressionLambda ?: error("TODO")
val invokeMethodDescriptor = lambdaInfo.invokeMethodDescriptor
val closureContext =
if (lambdaInfo.isPropertyReference)
@@ -157,7 +158,7 @@ class PsiSourceCompilerForInline(private val codegen: ExpressionCodegen, overrid
context: MethodContext,
expression: KtExpression,
jvmMethodSignature: JvmMethodSignature,
lambdaInfo: ExpressionLambda?
lambdaInfo: PsiExpressionLambda?
): SMAP {
val isLambda = lambdaInfo != null