IrTypes: minor: pass generator context where required
This commit is contained in:
@@ -57,7 +57,7 @@ class Psi2IrTranslator(val configuration: Psi2IrConfiguration = Psi2IrConfigurat
|
||||
}
|
||||
|
||||
private fun postprocess(context: GeneratorContext, irElement: IrElement) {
|
||||
insertImplicitCasts(context.builtIns, irElement, context.symbolTable)
|
||||
insertImplicitCasts(irElement, context)
|
||||
generateAnnotationsForDeclarations(context, irElement)
|
||||
|
||||
postprocessingSteps.forEach { it.postprocess(context, irElement) }
|
||||
|
||||
+2
-2
@@ -46,10 +46,10 @@ class ArrayAccessAssignmentReceiver(
|
||||
val irResultType = callGenerator.translateType(resultType)
|
||||
val irBlock = IrBlockImpl(startOffset, endOffset, irResultType, origin)
|
||||
|
||||
val irArrayValue = callGenerator.scope.createTemporaryVariableInBlock(irArray, irBlock, "array")
|
||||
val irArrayValue = callGenerator.scope.createTemporaryVariableInBlock(callGenerator.context, irArray, irBlock, "array")
|
||||
|
||||
val irIndexValues = irIndices.mapIndexed { i, irIndex ->
|
||||
callGenerator.scope.createTemporaryVariableInBlock(irIndex, irBlock, "index$i")
|
||||
callGenerator.scope.createTemporaryVariableInBlock(callGenerator.context, irIndex, irBlock, "index$i")
|
||||
}
|
||||
|
||||
indexedGetCall?.fillArrayAndIndexArguments(irArrayValue, irIndexValues)
|
||||
|
||||
+2
-2
@@ -43,12 +43,12 @@ abstract class PropertyLValueBase(
|
||||
val dispatchReceiverVariable2 = dispatchReceiverValue?.let {
|
||||
scope.createTemporaryVariable(dispatchReceiverValue.load(), "this")
|
||||
}
|
||||
val dispatchReceiverValue2 = dispatchReceiverVariable2?.let { VariableLValue(it) }
|
||||
val dispatchReceiverValue2 = dispatchReceiverVariable2?.let { VariableLValue(context, it) }
|
||||
|
||||
val extensionReceiverVariable2 = extensionReceiverValue?.let {
|
||||
scope.createTemporaryVariable(extensionReceiverValue.load(), "receiver")
|
||||
}
|
||||
val extensionReceiverValue2 = extensionReceiverVariable2?.let { VariableLValue(it) }
|
||||
val extensionReceiverValue2 = extensionReceiverVariable2?.let { VariableLValue(context, it) }
|
||||
|
||||
val irResultExpression = withLValue(withReceiver(dispatchReceiverValue2, extensionReceiverValue2))
|
||||
|
||||
|
||||
+3
-1
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.psi2ir.intermediate
|
||||
|
||||
import org.jetbrains.kotlin.ir.builders.IrGeneratorContext
|
||||
import org.jetbrains.kotlin.ir.builders.Scope
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpressionWithCopy
|
||||
@@ -31,11 +32,12 @@ class RematerializableValue(val irExpression: IrExpressionWithCopy) : Intermedia
|
||||
}
|
||||
|
||||
fun Scope.createTemporaryVariableInBlock(
|
||||
context: IrGeneratorContext,
|
||||
irExpression: IrExpression,
|
||||
block: IrContainerExpressionBase,
|
||||
nameHint: String? = null
|
||||
): IntermediateValue {
|
||||
val temporaryVariable = createTemporaryVariable(irExpression, nameHint)
|
||||
block.statements.add(temporaryVariable)
|
||||
return VariableLValue(temporaryVariable)
|
||||
return VariableLValue(context, temporaryVariable)
|
||||
}
|
||||
+1
-1
@@ -38,7 +38,7 @@ class SafeCallReceiver(
|
||||
|
||||
override fun call(withDispatchAndExtensionReceivers: (IntermediateValue?, IntermediateValue?) -> IrExpression): IrExpression {
|
||||
val irTmp = generator.scope.createTemporaryVariable(extensionReceiver?.load() ?: dispatchReceiver!!.load(), "safe_receiver")
|
||||
val safeReceiverValue = VariableLValue(irTmp)
|
||||
val safeReceiverValue = VariableLValue(generator.context, irTmp)
|
||||
|
||||
val dispatchReceiverValue: IntermediateValue?
|
||||
val extensionReceiverValue: IntermediateValue?
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ class SafeExtensionInvokeCallReceiver(
|
||||
|
||||
val irTmp = generator.scope.createTemporaryVariable(extensionInvokeReceiver.load(), "safe_receiver")
|
||||
|
||||
val safeReceiverValue = VariableLValue(irTmp)
|
||||
val safeReceiverValue = VariableLValue(generator.context, irTmp)
|
||||
|
||||
// Patch call and generate it
|
||||
assert(callBuilder.irValueArgumentsByIndex[0] == null) {
|
||||
|
||||
Reference in New Issue
Block a user