Adapt to changes in Scope.kt
(cherry picked from commit 9bafee3bf0393e6a25f2ee2f610b553392acc492)
This commit is contained in:
committed by
Vasily Levchenko
parent
c5ff865529
commit
4aa73c5b35
+3
-2
@@ -319,8 +319,9 @@ internal fun KotlinStubs.generateObjCCall(
|
||||
|
||||
val callBuilder = KotlinToCCallBuilder(builder, this@generateObjCCall, isObjCMethod = true, exceptionMode)
|
||||
|
||||
val superClass = irTemporaryVar(
|
||||
superQualifier?.let { getObjCClass(symbols, it) } ?: irNullNativePtr(symbols)
|
||||
val superClass = irTemporary(
|
||||
superQualifier?.let { getObjCClass(symbols, it) } ?: irNullNativePtr(symbols),
|
||||
isMutable = true
|
||||
)
|
||||
|
||||
val messenger = irCall(if (isStret) {
|
||||
|
||||
+4
-4
@@ -52,8 +52,8 @@ internal class CEnumByValueFunctionGenerator(
|
||||
// throw NPE
|
||||
byValueIrFunction.body = irBuilder(irBuiltIns, byValueIrFunction.symbol, SYNTHETIC_OFFSET, SYNTHETIC_OFFSET).irBlockBody {
|
||||
+irReturn(irBlock {
|
||||
val values = irTemporaryVar(irCall(valuesIrFunctionSymbol))
|
||||
val inductionVariable = irTemporaryVar(irInt(0))
|
||||
val values = irTemporary(irCall(valuesIrFunctionSymbol), isMutable = true)
|
||||
val inductionVariable = irTemporary(irInt(0), isMutable = true)
|
||||
val arrayClass = values.type.classOrNull!!
|
||||
val valuesSize = irCall(symbols.arraySize.getValue(arrayClass), irBuiltIns.intType).also { irCall ->
|
||||
irCall.dispatchReceiver = irGet(values)
|
||||
@@ -67,10 +67,10 @@ internal class CEnumByValueFunctionGenerator(
|
||||
irCall.putValueArgument(1, valuesSize)
|
||||
}
|
||||
loop.body = irBlock {
|
||||
val entry = irTemporaryVar(irCall(getElementFn, byValueIrFunction.returnType).also { irCall ->
|
||||
val entry = irTemporary(irCall(getElementFn, byValueIrFunction.returnType).also { irCall ->
|
||||
irCall.dispatchReceiver = irGet(values)
|
||||
irCall.putValueArgument(0, irGet(inductionVariable))
|
||||
})
|
||||
}, isMutable = true)
|
||||
val valueGetter = entry.type.getClass()!!.getPropertyGetter("value")!!
|
||||
val entryValue = irGet(irValueParameter.type, irGet(entry), valueGetter)
|
||||
+irIfThenElse(
|
||||
|
||||
+2
-1
@@ -767,7 +767,8 @@ private class InteropLoweringPart1(val context: Context) : BaseInteropIrTransfor
|
||||
// Special case: bridge from Objective-C method implementation template to Kotlin method;
|
||||
// handled in CodeGeneratorVisitor.callVirtual.
|
||||
val useKotlinDispatch = isInteropStubsFile &&
|
||||
builder.scope.scopeOwner.annotations.hasAnnotation(FqName("kotlin.native.internal.ExportForCppRuntime"))
|
||||
(builder.scope.scopeOwnerSymbol.owner as? IrAnnotationContainer)
|
||||
?.hasAnnotation(FqName("kotlin.native.internal.ExportForCppRuntime")) == true
|
||||
|
||||
if (!useKotlinDispatch) {
|
||||
val arguments = callee.valueParameters.map { expression.getValueArgument(it.index) }
|
||||
|
||||
+5
-4
@@ -103,18 +103,19 @@ internal class VarargInjectionLowering constructor(val context: KonanBackendCont
|
||||
val arrayHandle = arrayType(expression.type)
|
||||
|
||||
val vars = expression.elements.map {
|
||||
it to irTemporaryVar(
|
||||
it to irTemporary(
|
||||
(it as? IrSpreadElement)?.expression ?: it as IrExpression,
|
||||
"elem".synthesizedString
|
||||
"elem".synthesizedString,
|
||||
isMutable = true
|
||||
)
|
||||
}.toMap()
|
||||
val arraySize = calculateArraySize(arrayHandle, hasSpreadElement, scope, expression, vars)
|
||||
val array = arrayHandle.createArray(this, expression.varargElementType, arraySize)
|
||||
|
||||
val arrayTmpVariable = irTemporaryVar(array, "array".synthesizedString)
|
||||
val arrayTmpVariable = irTemporary(array, "array".synthesizedString, isMutable = true)
|
||||
lateinit var indexTmpVariable: IrVariable
|
||||
if (hasSpreadElement)
|
||||
indexTmpVariable = irTemporaryVar(kIntZero, "index".synthesizedString)
|
||||
indexTmpVariable = irTemporary(kIntZero, "index".synthesizedString, isMutable = true)
|
||||
expression.elements.forEachIndexed { i, element ->
|
||||
irBuilder.at(element.startOffset, element.endOffset)
|
||||
log { "element:$i> ${ir2string(element)}" }
|
||||
|
||||
+4
-4
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.ir.IrElement
|
||||
import org.jetbrains.kotlin.ir.builders.*
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.declarations.impl.IrVariableImpl
|
||||
import org.jetbrains.kotlin.ir.descriptors.IrTemporaryVariableDescriptorImpl
|
||||
import org.jetbrains.kotlin.ir.descriptors.WrappedVariableDescriptor
|
||||
import org.jetbrains.kotlin.ir.expressions.*
|
||||
import org.jetbrains.kotlin.ir.expressions.impl.*
|
||||
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
|
||||
@@ -1318,13 +1318,13 @@ internal object Devirtualization {
|
||||
}
|
||||
|
||||
fun <T : IrElement> IrStatementsBuilder<T>.irTemporary(value: IrExpression, tempName: String, type: IrType): IrVariable {
|
||||
val originalKotlinType = type.originalKotlinType ?: type.toKotlinType()
|
||||
val descriptor = IrTemporaryVariableDescriptorImpl(scope.scopeOwner, Name.identifier(tempName), originalKotlinType, false)
|
||||
val descriptor = WrappedVariableDescriptor()
|
||||
|
||||
val temporary = IrVariableImpl(
|
||||
value.startOffset, value.endOffset, IrDeclarationOrigin.IR_TEMPORARY_VARIABLE, IrVariableSymbolImpl(descriptor),
|
||||
descriptor.name, type, isVar = false, isConst = false, isLateinit = false
|
||||
Name.identifier(tempName), type, isVar = false, isConst = false, isLateinit = false
|
||||
).apply {
|
||||
descriptor.bind(this)
|
||||
this.initializer = value
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user