[IR] Renamed a lowering

Former CallableReferenceLowering actually only lowers function references,
property references are lowered in DelegationLowering
This commit is contained in:
Igor Chevdar
2020-08-15 15:48:38 +05:00
parent 37f335b483
commit f8341d73ef
4 changed files with 11 additions and 11 deletions
@@ -290,10 +290,10 @@ internal val delegationPhase = makeKonanFileLoweringPhase(
description = "Delegation lowering" description = "Delegation lowering"
) )
internal val callableReferencePhase = makeKonanFileLoweringPhase( internal val functionReferencePhase = makeKonanFileLoweringPhase(
::CallableReferenceLowering, ::FunctionReferenceLowering,
name = "CallableReference", name = "FunctionReference",
description = "Callable references lowering", description = "Function references lowering",
prerequisite = setOf(delegationPhase) // TODO: make weak dependency on `testProcessorPhase` prerequisite = setOf(delegationPhase) // TODO: make weak dependency on `testProcessorPhase`
) )
@@ -301,14 +301,14 @@ internal val interopPhase = makeKonanFileLoweringPhase(
::InteropLowering, ::InteropLowering,
name = "Interop", name = "Interop",
description = "Interop lowering", description = "Interop lowering",
prerequisite = setOf(inlinePhase, localFunctionsPhase, callableReferencePhase) prerequisite = setOf(inlinePhase, localFunctionsPhase, functionReferencePhase)
) )
internal val varargPhase = makeKonanFileLoweringPhase( internal val varargPhase = makeKonanFileLoweringPhase(
::VarargInjectionLowering, ::VarargInjectionLowering,
name = "Vararg", name = "Vararg",
description = "Vararg lowering", description = "Vararg lowering",
prerequisite = setOf(callableReferencePhase, defaultParameterExtentPhase, interopPhase) prerequisite = setOf(functionReferencePhase, defaultParameterExtentPhase, interopPhase)
) )
internal val compileTimeEvaluatePhase = makeKonanFileLoweringPhase( internal val compileTimeEvaluatePhase = makeKonanFileLoweringPhase(
@@ -376,7 +376,7 @@ internal val allLoweringsPhase = NamedCompilerPhase(
testProcessorPhase, testProcessorPhase,
enumClassPhase, enumClassPhase,
delegationPhase, delegationPhase,
callableReferencePhase, functionReferencePhase,
interopPhase, interopPhase,
varargPhase, varargPhase,
compileTimeEvaluatePhase, compileTimeEvaluatePhase,
@@ -42,7 +42,7 @@ import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.types.Variance import org.jetbrains.kotlin.types.Variance
import org.jetbrains.kotlin.util.OperatorNameConventions import org.jetbrains.kotlin.util.OperatorNameConventions
import org.jetbrains.kotlin.backend.konan.getObjCMethodInfo import org.jetbrains.kotlin.backend.konan.getObjCMethodInfo
import org.jetbrains.kotlin.backend.konan.lower.CallableReferenceLowering import org.jetbrains.kotlin.backend.konan.lower.FunctionReferenceLowering
import org.jetbrains.kotlin.builtins.StandardNames import org.jetbrains.kotlin.builtins.StandardNames
import org.jetbrains.kotlin.ir.descriptors.* import org.jetbrains.kotlin.ir.descriptors.*
@@ -263,7 +263,7 @@ private fun <R> KotlinToCCallBuilder.handleArgumentForVarargParameter(
} else { } else {
stubs.throwCompilerError(initializer, "unexpected initializer") stubs.throwCompilerError(initializer, "unexpected initializer")
} }
} else if (variable is IrValueParameter && CallableReferenceLowering.isLoweredCallableReference(variable)) { } else if (variable is IrValueParameter && FunctionReferenceLowering.isLoweredFunctionReference(variable)) {
val location = variable.parent // Parameter itself has incorrect location. val location = variable.parent // Parameter itself has incorrect location.
val kind = if (this.isObjCMethod) "Objective-C methods" else "C functions" val kind = if (this.isObjCMethod) "Objective-C methods" else "C functions"
stubs.reportError(location, "callable references to variadic $kind are not supported") stubs.reportError(location, "callable references to variadic $kind are not supported")
@@ -40,12 +40,12 @@ import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.name.Name
internal class CallableReferenceLowering(val context: Context): FileLoweringPass { internal class FunctionReferenceLowering(val context: Context): FileLoweringPass {
private object DECLARATION_ORIGIN_FUNCTION_REFERENCE_IMPL : IrDeclarationOriginImpl("FUNCTION_REFERENCE_IMPL") private object DECLARATION_ORIGIN_FUNCTION_REFERENCE_IMPL : IrDeclarationOriginImpl("FUNCTION_REFERENCE_IMPL")
companion object { companion object {
fun isLoweredCallableReference(declaration: IrDeclaration): Boolean = fun isLoweredFunctionReference(declaration: IrDeclaration): Boolean =
declaration.origin == DECLARATION_ORIGIN_FUNCTION_REFERENCE_IMPL declaration.origin == DECLARATION_ORIGIN_FUNCTION_REFERENCE_IMPL
} }