IR: do not use Ir*Impl elements where it's not necessary
This commit is contained in:
+9
-7
@@ -122,7 +122,7 @@ inline fun IrProperty.addSetter(builder: IrFunctionBuilder.() -> Unit = {}): IrS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun IrFunctionBuilder.buildFun(originalDescriptor: FunctionDescriptor? = null): IrFunctionImpl {
|
fun IrFunctionBuilder.buildFun(originalDescriptor: FunctionDescriptor? = null): IrSimpleFunction {
|
||||||
val wrappedDescriptor = when (originalDescriptor) {
|
val wrappedDescriptor = when (originalDescriptor) {
|
||||||
is DescriptorWithContainerSource -> WrappedFunctionDescriptorWithContainerSource(originalDescriptor.containerSource)
|
is DescriptorWithContainerSource -> WrappedFunctionDescriptorWithContainerSource(originalDescriptor.containerSource)
|
||||||
is PropertyGetterDescriptor -> WrappedPropertyGetterDescriptor(originalDescriptor.annotations, originalDescriptor.source)
|
is PropertyGetterDescriptor -> WrappedPropertyGetterDescriptor(originalDescriptor.annotations, originalDescriptor.source)
|
||||||
@@ -141,7 +141,7 @@ fun IrFunctionBuilder.buildFun(originalDescriptor: FunctionDescriptor? = null):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun IrFunctionBuilder.buildConstructor(): IrConstructorImpl {
|
fun IrFunctionBuilder.buildConstructor(): IrConstructor {
|
||||||
val wrappedDescriptor = WrappedClassConstructorDescriptor()
|
val wrappedDescriptor = WrappedClassConstructorDescriptor()
|
||||||
return IrConstructorImpl(
|
return IrConstructorImpl(
|
||||||
startOffset, endOffset, origin,
|
startOffset, endOffset, origin,
|
||||||
@@ -159,19 +159,21 @@ fun IrFunctionBuilder.buildConstructor(): IrConstructorImpl {
|
|||||||
* potentially external function (e.g. in an IrCall) we have to ensure that we keep
|
* potentially external function (e.g. in an IrCall) we have to ensure that we keep
|
||||||
* information from the original descriptor so as not to break inlining.
|
* information from the original descriptor so as not to break inlining.
|
||||||
*/
|
*/
|
||||||
inline fun buildFunWithDescriptorForInlining(originalDescriptor: FunctionDescriptor, builder: IrFunctionBuilder.() -> Unit): IrFunctionImpl =
|
inline fun buildFunWithDescriptorForInlining(
|
||||||
|
originalDescriptor: FunctionDescriptor, builder: IrFunctionBuilder.() -> Unit
|
||||||
|
): IrSimpleFunction =
|
||||||
IrFunctionBuilder().run {
|
IrFunctionBuilder().run {
|
||||||
builder()
|
builder()
|
||||||
buildFun(originalDescriptor)
|
buildFun(originalDescriptor)
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun buildFun(builder: IrFunctionBuilder.() -> Unit): IrFunctionImpl =
|
inline fun buildFun(builder: IrFunctionBuilder.() -> Unit): IrSimpleFunction =
|
||||||
IrFunctionBuilder().run {
|
IrFunctionBuilder().run {
|
||||||
builder()
|
builder()
|
||||||
buildFun()
|
buildFun()
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun IrDeclarationContainer.addFunction(builder: IrFunctionBuilder.() -> Unit): IrFunctionImpl =
|
inline fun IrDeclarationContainer.addFunction(builder: IrFunctionBuilder.() -> Unit): IrSimpleFunction =
|
||||||
buildFun(builder).also { function ->
|
buildFun(builder).also { function ->
|
||||||
declarations.add(function)
|
declarations.add(function)
|
||||||
function.parent = this@addFunction
|
function.parent = this@addFunction
|
||||||
@@ -201,13 +203,13 @@ fun IrDeclarationContainer.addFunction(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun buildConstructor(builder: IrFunctionBuilder.() -> Unit): IrConstructorImpl =
|
inline fun buildConstructor(builder: IrFunctionBuilder.() -> Unit): IrConstructor =
|
||||||
IrFunctionBuilder().run {
|
IrFunctionBuilder().run {
|
||||||
builder()
|
builder()
|
||||||
buildConstructor()
|
buildConstructor()
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun IrClass.addConstructor(builder: IrFunctionBuilder.() -> Unit = {}): IrConstructorImpl =
|
inline fun IrClass.addConstructor(builder: IrFunctionBuilder.() -> Unit = {}): IrConstructor =
|
||||||
buildConstructor {
|
buildConstructor {
|
||||||
builder()
|
builder()
|
||||||
returnType = defaultType
|
returnType = defaultType
|
||||||
|
|||||||
+1
-2
@@ -7,7 +7,6 @@ package org.jetbrains.kotlin.ir.backend.js.lower
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.backend.common.CommonBackendContext
|
import org.jetbrains.kotlin.backend.common.CommonBackendContext
|
||||||
import org.jetbrains.kotlin.backend.common.FileLoweringPass
|
import org.jetbrains.kotlin.backend.common.FileLoweringPass
|
||||||
import org.jetbrains.kotlin.backend.common.phaser.makeIrModulePhase
|
|
||||||
import org.jetbrains.kotlin.descriptors.Modality
|
import org.jetbrains.kotlin.descriptors.Modality
|
||||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||||
import org.jetbrains.kotlin.ir.IrStatement
|
import org.jetbrains.kotlin.ir.IrStatement
|
||||||
@@ -89,7 +88,7 @@ class CreateScriptFunctionsPhase(val context: CommonBackendContext) : FileLoweri
|
|||||||
return (irScript.statements.lastOrNull() as? IrExpression)?.type ?: context.irBuiltIns.unitType
|
return (irScript.statements.lastOrNull() as? IrExpression)?.type ?: context.irBuiltIns.unitType
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createFunction(irScript: IrScript, name: String, returnType: IrType): IrFunctionImpl {
|
private fun createFunction(irScript: IrScript, name: String, returnType: IrType): IrSimpleFunction {
|
||||||
val (startOffset, endOffset) = getFunctionBodyOffsets(irScript)
|
val (startOffset, endOffset) = getFunctionBodyOffsets(irScript)
|
||||||
val descriptor = WrappedSimpleFunctionDescriptor()
|
val descriptor = WrappedSimpleFunctionDescriptor()
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ import org.jetbrains.kotlin.ir.builders.IrBuilderWithScope
|
|||||||
import org.jetbrains.kotlin.ir.builders.irBlock
|
import org.jetbrains.kotlin.ir.builders.irBlock
|
||||||
import org.jetbrains.kotlin.ir.builders.irNull
|
import org.jetbrains.kotlin.ir.builders.irNull
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.IrConstructorImpl
|
|
||||||
import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns
|
import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrFunctionReference
|
import org.jetbrains.kotlin.ir.expressions.IrFunctionReference
|
||||||
@@ -101,7 +100,7 @@ class JvmBackendContext(
|
|||||||
internal val multifileFacadeClassForPart = mutableMapOf<IrClass, IrClass>()
|
internal val multifileFacadeClassForPart = mutableMapOf<IrClass, IrClass>()
|
||||||
internal val multifileFacadeMemberToPartMember = mutableMapOf<IrFunction, IrFunction>()
|
internal val multifileFacadeMemberToPartMember = mutableMapOf<IrFunction, IrFunction>()
|
||||||
|
|
||||||
internal val hiddenConstructors = mutableMapOf<IrConstructor, IrConstructorImpl>()
|
internal val hiddenConstructors = mutableMapOf<IrConstructor, IrConstructor>()
|
||||||
|
|
||||||
internal val collectionStubComputer = CollectionStubComputer(this)
|
internal val collectionStubComputer = CollectionStubComputer(this)
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -24,7 +24,6 @@ import org.jetbrains.kotlin.ir.builders.declarations.addField
|
|||||||
import org.jetbrains.kotlin.ir.builders.declarations.addValueParameter
|
import org.jetbrains.kotlin.ir.builders.declarations.addValueParameter
|
||||||
import org.jetbrains.kotlin.ir.builders.declarations.buildConstructor
|
import org.jetbrains.kotlin.ir.builders.declarations.buildConstructor
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.IrConstructorImpl
|
|
||||||
import org.jetbrains.kotlin.ir.expressions.*
|
import org.jetbrains.kotlin.ir.expressions.*
|
||||||
import org.jetbrains.kotlin.ir.expressions.impl.IrExpressionBodyImpl
|
import org.jetbrains.kotlin.ir.expressions.impl.IrExpressionBodyImpl
|
||||||
import org.jetbrains.kotlin.ir.expressions.impl.IrGetValueImpl
|
import org.jetbrains.kotlin.ir.expressions.impl.IrGetValueImpl
|
||||||
@@ -53,7 +52,7 @@ private class EnumClassLowering(val context: JvmBackendContext) : ClassLoweringP
|
|||||||
}
|
}
|
||||||
|
|
||||||
private inner class EnumClassTransformer(val irClass: IrClass) {
|
private inner class EnumClassTransformer(val irClass: IrClass) {
|
||||||
private val loweredEnumConstructors = hashMapOf<IrConstructorSymbol, IrConstructorImpl>()
|
private val loweredEnumConstructors = hashMapOf<IrConstructorSymbol, IrConstructor>()
|
||||||
private val loweredEnumConstructorParameters = hashMapOf<IrValueParameterSymbol, IrValueParameter>()
|
private val loweredEnumConstructorParameters = hashMapOf<IrValueParameterSymbol, IrValueParameter>()
|
||||||
private val enumEntryOrdinals = TObjectIntHashMap<IrEnumEntry>()
|
private val enumEntryOrdinals = TObjectIntHashMap<IrEnumEntry>()
|
||||||
private val declarationToEnumEntry = mutableMapOf<IrDeclaration, IrEnumEntry>()
|
private val declarationToEnumEntry = mutableMapOf<IrDeclaration, IrEnumEntry>()
|
||||||
|
|||||||
+5
-4
@@ -15,13 +15,11 @@ import org.jetbrains.kotlin.backend.jvm.ir.needsAccessor
|
|||||||
import org.jetbrains.kotlin.config.LanguageFeature
|
import org.jetbrains.kotlin.config.LanguageFeature
|
||||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||||
import org.jetbrains.kotlin.descriptors.Modality
|
import org.jetbrains.kotlin.descriptors.Modality
|
||||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
|
||||||
import org.jetbrains.kotlin.ir.IrStatement
|
import org.jetbrains.kotlin.ir.IrStatement
|
||||||
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
||||||
import org.jetbrains.kotlin.ir.builders.*
|
import org.jetbrains.kotlin.ir.builders.*
|
||||||
import org.jetbrains.kotlin.ir.builders.declarations.buildFun
|
import org.jetbrains.kotlin.ir.builders.declarations.buildFun
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl
|
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrCall
|
import org.jetbrains.kotlin.ir.expressions.IrCall
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrFieldAccessExpression
|
import org.jetbrains.kotlin.ir.expressions.IrFieldAccessExpression
|
||||||
@@ -29,7 +27,10 @@ import org.jetbrains.kotlin.ir.expressions.impl.IrBlockBodyImpl
|
|||||||
import org.jetbrains.kotlin.ir.types.classifierOrFail
|
import org.jetbrains.kotlin.ir.types.classifierOrFail
|
||||||
import org.jetbrains.kotlin.ir.types.makeNotNull
|
import org.jetbrains.kotlin.ir.types.makeNotNull
|
||||||
import org.jetbrains.kotlin.ir.types.typeWith
|
import org.jetbrains.kotlin.ir.types.typeWith
|
||||||
import org.jetbrains.kotlin.ir.util.*
|
import org.jetbrains.kotlin.ir.util.coerceToUnit
|
||||||
|
import org.jetbrains.kotlin.ir.util.render
|
||||||
|
import org.jetbrains.kotlin.ir.util.resolveFakeOverride
|
||||||
|
import org.jetbrains.kotlin.ir.util.transformDeclarationsFlat
|
||||||
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
|
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
|
||||||
import org.jetbrains.kotlin.load.java.JvmAbi
|
import org.jetbrains.kotlin.load.java.JvmAbi
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
@@ -119,7 +120,7 @@ class JvmPropertiesLowering(private val backendContext: JvmBackendContext) : IrE
|
|||||||
private fun shouldSubstituteAccessorWithField(property: IrProperty, accessor: IrSimpleFunction?): Boolean =
|
private fun shouldSubstituteAccessorWithField(property: IrProperty, accessor: IrSimpleFunction?): Boolean =
|
||||||
accessor != null && !property.needsAccessor(accessor)
|
accessor != null && !property.needsAccessor(accessor)
|
||||||
|
|
||||||
private fun createSyntheticMethodForAnnotations(declaration: IrProperty): IrFunctionImpl =
|
private fun createSyntheticMethodForAnnotations(declaration: IrProperty): IrSimpleFunction =
|
||||||
buildFun {
|
buildFun {
|
||||||
origin = JvmLoweredDeclarationOrigin.SYNTHETIC_METHOD_FOR_PROPERTY_ANNOTATIONS
|
origin = JvmLoweredDeclarationOrigin.SYNTHETIC_METHOD_FOR_PROPERTY_ANNOTATIONS
|
||||||
name = Name.identifier(computeSyntheticMethodName(declaration))
|
name = Name.identifier(computeSyntheticMethodName(declaration))
|
||||||
|
|||||||
+2
-3
@@ -26,7 +26,6 @@ import org.jetbrains.kotlin.ir.builders.declarations.addValueParameter
|
|||||||
import org.jetbrains.kotlin.ir.builders.declarations.buildConstructor
|
import org.jetbrains.kotlin.ir.builders.declarations.buildConstructor
|
||||||
import org.jetbrains.kotlin.ir.builders.declarations.buildFun
|
import org.jetbrains.kotlin.ir.builders.declarations.buildFun
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.IrConstructorImpl
|
|
||||||
import org.jetbrains.kotlin.ir.expressions.*
|
import org.jetbrains.kotlin.ir.expressions.*
|
||||||
import org.jetbrains.kotlin.ir.expressions.impl.*
|
import org.jetbrains.kotlin.ir.expressions.impl.*
|
||||||
import org.jetbrains.kotlin.ir.symbols.*
|
import org.jetbrains.kotlin.ir.symbols.*
|
||||||
@@ -219,7 +218,7 @@ internal class SyntheticAccessorLowering(val context: JvmBackendContext) : IrEle
|
|||||||
origin != JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR &&
|
origin != JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR &&
|
||||||
origin != JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR_FOR_HIDDEN_CONSTRUCTOR)
|
origin != JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR_FOR_HIDDEN_CONSTRUCTOR)
|
||||||
|
|
||||||
private fun handleHiddenConstructor(declaration: IrConstructor): IrConstructorImpl {
|
private fun handleHiddenConstructor(declaration: IrConstructor): IrConstructor {
|
||||||
require(declaration.isOrShouldBeHidden, declaration::render)
|
require(declaration.isOrShouldBeHidden, declaration::render)
|
||||||
return context.hiddenConstructors.getOrPut(declaration) {
|
return context.hiddenConstructors.getOrPut(declaration) {
|
||||||
declaration.makeConstructorAccessor(JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR_FOR_HIDDEN_CONSTRUCTOR).also { accessor ->
|
declaration.makeConstructorAccessor(JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR_FOR_HIDDEN_CONSTRUCTOR).also { accessor ->
|
||||||
@@ -254,7 +253,7 @@ internal class SyntheticAccessorLowering(val context: JvmBackendContext) : IrEle
|
|||||||
private fun IrConstructor.makeConstructorAccessor(
|
private fun IrConstructor.makeConstructorAccessor(
|
||||||
originForConstructorAccessor: IrDeclarationOrigin =
|
originForConstructorAccessor: IrDeclarationOrigin =
|
||||||
JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR
|
JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR
|
||||||
): IrConstructorImpl {
|
): IrConstructor {
|
||||||
val source = this
|
val source = this
|
||||||
|
|
||||||
return buildConstructor {
|
return buildConstructor {
|
||||||
|
|||||||
+1
-2
@@ -19,7 +19,6 @@ import org.jetbrains.kotlin.ir.builders.declarations.buildFun
|
|||||||
import org.jetbrains.kotlin.ir.builders.declarations.buildFunWithDescriptorForInlining
|
import org.jetbrains.kotlin.ir.builders.declarations.buildFunWithDescriptorForInlining
|
||||||
import org.jetbrains.kotlin.ir.builders.declarations.buildProperty
|
import org.jetbrains.kotlin.ir.builders.declarations.buildProperty
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl
|
|
||||||
import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns
|
import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrPropertySymbol
|
import org.jetbrains.kotlin.ir.symbols.IrPropertySymbol
|
||||||
import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl
|
import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl
|
||||||
@@ -184,7 +183,7 @@ class MemoizedInlineClassReplacements(private val mangleReturnTypes: Boolean) {
|
|||||||
function: IrFunction,
|
function: IrFunction,
|
||||||
replacementOrigin: IrDeclarationOrigin,
|
replacementOrigin: IrDeclarationOrigin,
|
||||||
noFakeOverride: Boolean = false,
|
noFakeOverride: Boolean = false,
|
||||||
body: IrFunctionImpl.() -> Unit
|
body: IrFunction.() -> Unit
|
||||||
) = buildFunWithDescriptorForInlining(function.descriptor) {
|
) = buildFunWithDescriptorForInlining(function.descriptor) {
|
||||||
updateFrom(function)
|
updateFrom(function)
|
||||||
if (function is IrConstructor) {
|
if (function is IrConstructor) {
|
||||||
|
|||||||
+8
-11
@@ -5,6 +5,13 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.ir.interpreter
|
package org.jetbrains.kotlin.ir.interpreter
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.ir.IrElement
|
||||||
|
import org.jetbrains.kotlin.ir.IrStatement
|
||||||
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
|
import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns
|
||||||
|
import org.jetbrains.kotlin.ir.expressions.*
|
||||||
|
import org.jetbrains.kotlin.ir.expressions.impl.IrConstructorCallImpl
|
||||||
|
import org.jetbrains.kotlin.ir.expressions.impl.IrErrorExpressionImpl
|
||||||
import org.jetbrains.kotlin.ir.interpreter.builtins.*
|
import org.jetbrains.kotlin.ir.interpreter.builtins.*
|
||||||
import org.jetbrains.kotlin.ir.interpreter.exceptions.InterpreterException
|
import org.jetbrains.kotlin.ir.interpreter.exceptions.InterpreterException
|
||||||
import org.jetbrains.kotlin.ir.interpreter.exceptions.InterpreterMethodNotFoundException
|
import org.jetbrains.kotlin.ir.interpreter.exceptions.InterpreterMethodNotFoundException
|
||||||
@@ -13,15 +20,6 @@ import org.jetbrains.kotlin.ir.interpreter.intrinsics.IntrinsicEvaluator
|
|||||||
import org.jetbrains.kotlin.ir.interpreter.stack.StackImpl
|
import org.jetbrains.kotlin.ir.interpreter.stack.StackImpl
|
||||||
import org.jetbrains.kotlin.ir.interpreter.stack.Variable
|
import org.jetbrains.kotlin.ir.interpreter.stack.Variable
|
||||||
import org.jetbrains.kotlin.ir.interpreter.state.*
|
import org.jetbrains.kotlin.ir.interpreter.state.*
|
||||||
import org.jetbrains.kotlin.ir.IrElement
|
|
||||||
import org.jetbrains.kotlin.ir.IrStatement
|
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl
|
|
||||||
import org.jetbrains.kotlin.ir.declarations.lazy.IrLazyFunction
|
|
||||||
import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns
|
|
||||||
import org.jetbrains.kotlin.ir.expressions.*
|
|
||||||
import org.jetbrains.kotlin.ir.expressions.impl.IrConstructorCallImpl
|
|
||||||
import org.jetbrains.kotlin.ir.expressions.impl.IrErrorExpressionImpl
|
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||||
import org.jetbrains.kotlin.ir.types.*
|
import org.jetbrains.kotlin.ir.types.*
|
||||||
import org.jetbrains.kotlin.ir.types.impl.originalKotlinType
|
import org.jetbrains.kotlin.ir.types.impl.originalKotlinType
|
||||||
@@ -100,8 +98,7 @@ class IrInterpreter(private val irBuiltIns: IrBuiltIns, private val bodyMap: Map
|
|||||||
try {
|
try {
|
||||||
incrementAndCheckCommands()
|
incrementAndCheckCommands()
|
||||||
val executionResult = when (this) {
|
val executionResult = when (this) {
|
||||||
is IrFunctionImpl -> interpretFunction(this)
|
is IrSimpleFunction -> interpretFunction(this)
|
||||||
is IrLazyFunction -> interpretFunction(this as IrSimpleFunction)
|
|
||||||
is IrCall -> interpretCall(this)
|
is IrCall -> interpretCall(this)
|
||||||
is IrConstructorCall -> interpretConstructorCall(this)
|
is IrConstructorCall -> interpretConstructorCall(this)
|
||||||
is IrEnumConstructorCall -> interpretEnumConstructorCall(this)
|
is IrEnumConstructorCall -> interpretEnumConstructorCall(this)
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import org.jetbrains.kotlin.ir.interpreter.stack.Stack
|
|||||||
import org.jetbrains.kotlin.ir.interpreter.state.Primitive
|
import org.jetbrains.kotlin.ir.interpreter.state.Primitive
|
||||||
import org.jetbrains.kotlin.ir.interpreter.state.isSubtypeOf
|
import org.jetbrains.kotlin.ir.interpreter.state.isSubtypeOf
|
||||||
import org.jetbrains.kotlin.ir.IrElement
|
import org.jetbrains.kotlin.ir.IrElement
|
||||||
|
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl
|
import org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl
|
||||||
import org.jetbrains.kotlin.ir.declarations.lazy.IrLazyFunction
|
import org.jetbrains.kotlin.ir.declarations.lazy.IrLazyFunction
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrCall
|
import org.jetbrains.kotlin.ir.expressions.IrCall
|
||||||
@@ -30,7 +31,7 @@ open class ExecutionResult(val returnLabel: ReturnLabel, private val owner: IrEl
|
|||||||
fun getNextLabel(irElement: IrElement, interpret: IrElement.() -> ExecutionResult): ExecutionResult {
|
fun getNextLabel(irElement: IrElement, interpret: IrElement.() -> ExecutionResult): ExecutionResult {
|
||||||
return when (returnLabel) {
|
return when (returnLabel) {
|
||||||
ReturnLabel.RETURN -> when (irElement) {
|
ReturnLabel.RETURN -> when (irElement) {
|
||||||
is IrCall, is IrReturnableBlock, is IrFunctionImpl, is IrLazyFunction -> if (owner == irElement) Next else this
|
is IrCall, is IrReturnableBlock, is IrSimpleFunction -> if (owner == irElement) Next else this
|
||||||
else -> this
|
else -> this
|
||||||
}
|
}
|
||||||
ReturnLabel.BREAK_WHEN -> when (irElement) {
|
ReturnLabel.BREAK_WHEN -> when (irElement) {
|
||||||
|
|||||||
@@ -5,18 +5,18 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.ir.interpreter.state
|
package org.jetbrains.kotlin.ir.interpreter.state
|
||||||
|
|
||||||
import org.jetbrains.kotlin.ir.interpreter.builtins.evaluateIntrinsicAnnotation
|
|
||||||
import org.jetbrains.kotlin.ir.interpreter.*
|
|
||||||
import org.jetbrains.kotlin.ir.interpreter.getEvaluateIntrinsicValue
|
|
||||||
import org.jetbrains.kotlin.ir.interpreter.getPrimitiveClass
|
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrClass
|
import org.jetbrains.kotlin.ir.declarations.IrClass
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrField
|
import org.jetbrains.kotlin.ir.declarations.IrField
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrFunction
|
import org.jetbrains.kotlin.ir.declarations.IrFunction
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
|
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl
|
import org.jetbrains.kotlin.ir.interpreter.*
|
||||||
|
import org.jetbrains.kotlin.ir.interpreter.builtins.evaluateIntrinsicAnnotation
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
|
||||||
import org.jetbrains.kotlin.ir.types.*
|
import org.jetbrains.kotlin.ir.types.*
|
||||||
import org.jetbrains.kotlin.ir.util.*
|
import org.jetbrains.kotlin.ir.util.defaultType
|
||||||
|
import org.jetbrains.kotlin.ir.util.fqNameForIrSerialization
|
||||||
|
import org.jetbrains.kotlin.ir.util.fqNameWhenAvailable
|
||||||
|
import org.jetbrains.kotlin.ir.util.parentAsClass
|
||||||
import java.lang.invoke.MethodHandle
|
import java.lang.invoke.MethodHandle
|
||||||
import java.lang.invoke.MethodHandles
|
import java.lang.invoke.MethodHandles
|
||||||
import java.lang.invoke.MethodType
|
import java.lang.invoke.MethodType
|
||||||
@@ -144,7 +144,7 @@ internal class Wrapper(val value: Any, override val irClass: IrClass) : Complex(
|
|||||||
|
|
||||||
private fun IrFunction.getOriginalOverriddenSymbols(): MutableList<IrFunctionSymbol> {
|
private fun IrFunction.getOriginalOverriddenSymbols(): MutableList<IrFunctionSymbol> {
|
||||||
val overriddenSymbols = mutableListOf<IrFunctionSymbol>()
|
val overriddenSymbols = mutableListOf<IrFunctionSymbol>()
|
||||||
if (this is IrFunctionImpl) {
|
if (this is IrSimpleFunction) {
|
||||||
val pool = this.overriddenSymbols.toMutableList()
|
val pool = this.overriddenSymbols.toMutableList()
|
||||||
val iterator = pool.listIterator()
|
val iterator = pool.listIterator()
|
||||||
for (symbol in iterator) {
|
for (symbol in iterator) {
|
||||||
|
|||||||
+8
-8
@@ -19,8 +19,8 @@ package org.jetbrains.kotlin.ir.declarations.impl
|
|||||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor
|
import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.impl.EmptyPackageFragmentDescriptor
|
import org.jetbrains.kotlin.descriptors.impl.EmptyPackageFragmentDescriptor
|
||||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
|
||||||
import org.jetbrains.kotlin.ir.IrElementBase
|
import org.jetbrains.kotlin.ir.IrElementBase
|
||||||
|
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||||
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
|
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrExternalPackageFragment
|
import org.jetbrains.kotlin.ir.declarations.IrExternalPackageFragment
|
||||||
@@ -29,6 +29,7 @@ import org.jetbrains.kotlin.ir.symbols.impl.IrExternalPackageFragmentSymbolImpl
|
|||||||
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
|
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
|
||||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.FqName
|
||||||
|
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedMemberDescriptor
|
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedMemberDescriptor
|
||||||
|
|
||||||
class IrExternalPackageFragmentImpl(
|
class IrExternalPackageFragmentImpl(
|
||||||
@@ -42,12 +43,14 @@ class IrExternalPackageFragmentImpl(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ObsoleteDescriptorBasedAPI
|
@ObsoleteDescriptorBasedAPI
|
||||||
override val packageFragmentDescriptor: PackageFragmentDescriptor get() = symbol.descriptor
|
override val packageFragmentDescriptor: PackageFragmentDescriptor
|
||||||
|
get() = symbol.descriptor
|
||||||
|
|
||||||
override val declarations: MutableList<IrDeclaration> = ArrayList()
|
override val declarations: MutableList<IrDeclaration> = ArrayList()
|
||||||
|
|
||||||
@OptIn(ObsoleteDescriptorBasedAPI::class)
|
@OptIn(ObsoleteDescriptorBasedAPI::class)
|
||||||
override val containerSource get() = (symbol.descriptor as? DeserializedMemberDescriptor)?.containerSource
|
override val containerSource: DeserializedContainerSource?
|
||||||
|
get() = (symbol.descriptor as? DeserializedMemberDescriptor)?.containerSource
|
||||||
|
|
||||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
|
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
|
||||||
visitor.visitExternalPackageFragment(this, data)
|
visitor.visitExternalPackageFragment(this, data)
|
||||||
@@ -63,12 +66,9 @@ class IrExternalPackageFragmentImpl(
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun createEmptyExternalPackageFragment(
|
fun createEmptyExternalPackageFragment(module: ModuleDescriptor, fqName: FqName): IrExternalPackageFragment =
|
||||||
module: ModuleDescriptor,
|
|
||||||
fqName: FqName
|
|
||||||
): IrExternalPackageFragmentImpl =
|
|
||||||
IrExternalPackageFragmentImpl(
|
IrExternalPackageFragmentImpl(
|
||||||
IrExternalPackageFragmentSymbolImpl(EmptyPackageFragmentDescriptor(module, fqName)), fqName
|
IrExternalPackageFragmentSymbolImpl(EmptyPackageFragmentDescriptor(module, fqName)), fqName
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,9 @@
|
|||||||
package org.jetbrains.kotlin.ir.util
|
package org.jetbrains.kotlin.ir.util
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.ScriptDescriptor
|
import org.jetbrains.kotlin.descriptors.ScriptDescriptor
|
||||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
|
||||||
import org.jetbrains.kotlin.ir.IrElement
|
import org.jetbrains.kotlin.ir.IrElement
|
||||||
import org.jetbrains.kotlin.ir.IrStatement
|
import org.jetbrains.kotlin.ir.IrStatement
|
||||||
|
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.*
|
import org.jetbrains.kotlin.ir.declarations.impl.*
|
||||||
import org.jetbrains.kotlin.ir.expressions.*
|
import org.jetbrains.kotlin.ir.expressions.*
|
||||||
@@ -307,7 +307,7 @@ open class DeepCopyIrTreeWithSymbols(
|
|||||||
declaration.superTypes.mapTo(superTypes) { it.remapType() }
|
declaration.superTypes.mapTo(superTypes) { it.remapType() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun copyTypeParameter(declaration: IrTypeParameter) =
|
private fun copyTypeParameter(declaration: IrTypeParameter): IrTypeParameter =
|
||||||
IrTypeParameterImpl(
|
IrTypeParameterImpl(
|
||||||
declaration.startOffset, declaration.endOffset,
|
declaration.startOffset, declaration.endOffset,
|
||||||
mapDeclarationOrigin(declaration.origin),
|
mapDeclarationOrigin(declaration.origin),
|
||||||
|
|||||||
+12
-12
@@ -997,7 +997,7 @@ abstract class IrFileDeserializer(
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun deserializeIrValueParameter(proto: ProtoValueParameter, index: Int) =
|
private fun deserializeIrValueParameter(proto: ProtoValueParameter, index: Int): IrValueParameter =
|
||||||
withDeserializedIrDeclarationBase(proto.base) { symbol, _, startOffset, endOffset, origin, fcode ->
|
withDeserializedIrDeclarationBase(proto.base) { symbol, _, startOffset, endOffset, origin, fcode ->
|
||||||
val flags = ValueParameterFlags.decode(fcode)
|
val flags = ValueParameterFlags.decode(fcode)
|
||||||
val nameAndType = BinaryNameAndType.decode(proto.nameType)
|
val nameAndType = BinaryNameAndType.decode(proto.nameType)
|
||||||
@@ -1019,7 +1019,7 @@ abstract class IrFileDeserializer(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun deserializeIrClass(proto: ProtoClass) =
|
private fun deserializeIrClass(proto: ProtoClass): IrClass =
|
||||||
withDeserializedIrDeclarationBase(proto.base) { symbol, signature, startOffset, endOffset, origin, fcode ->
|
withDeserializedIrDeclarationBase(proto.base) { symbol, signature, startOffset, endOffset, origin, fcode ->
|
||||||
val flags = ClassFlags.decode(fcode)
|
val flags = ClassFlags.decode(fcode)
|
||||||
|
|
||||||
@@ -1054,7 +1054,7 @@ abstract class IrFileDeserializer(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun deserializeIrTypeAlias(proto: ProtoTypeAlias) =
|
private fun deserializeIrTypeAlias(proto: ProtoTypeAlias): IrTypeAlias =
|
||||||
withDeserializedIrDeclarationBase(proto.base) { symbol, uniqId, startOffset, endOffset, origin, fcode ->
|
withDeserializedIrDeclarationBase(proto.base) { symbol, uniqId, startOffset, endOffset, origin, fcode ->
|
||||||
symbolTable.declareTypeAliasFromLinker((symbol as IrTypeAliasSymbol).descriptor, uniqId) {
|
symbolTable.declareTypeAliasFromLinker((symbol as IrTypeAliasSymbol).descriptor, uniqId) {
|
||||||
val flags = TypeAliasFlags.decode(fcode)
|
val flags = TypeAliasFlags.decode(fcode)
|
||||||
@@ -1113,7 +1113,7 @@ abstract class IrFileDeserializer(
|
|||||||
private inline fun <T : IrFunction> withDeserializedIrFunctionBase(
|
private inline fun <T : IrFunction> withDeserializedIrFunctionBase(
|
||||||
proto: ProtoFunctionBase,
|
proto: ProtoFunctionBase,
|
||||||
block: (IrFunctionSymbol, IdSignature, Int, Int, IrDeclarationOrigin, Long) -> T
|
block: (IrFunctionSymbol, IdSignature, Int, Int, IrDeclarationOrigin, Long) -> T
|
||||||
) = withDeserializedIrDeclarationBase(proto.base) { symbol, idSig, startOffset, endOffset, origin, fcode ->
|
): T = withDeserializedIrDeclarationBase(proto.base) { symbol, idSig, startOffset, endOffset, origin, fcode ->
|
||||||
symbolTable.withScope(symbol.descriptor) {
|
symbolTable.withScope(symbol.descriptor) {
|
||||||
block(symbol as IrFunctionSymbol, idSig, startOffset, endOffset, origin, fcode).usingParent {
|
block(symbol as IrFunctionSymbol, idSig, startOffset, endOffset, origin, fcode).usingParent {
|
||||||
withInlineGuard {
|
withInlineGuard {
|
||||||
@@ -1163,7 +1163,7 @@ abstract class IrFileDeserializer(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun deserializeIrVariable(proto: ProtoVariable) =
|
private fun deserializeIrVariable(proto: ProtoVariable): IrVariable =
|
||||||
withDeserializedIrDeclarationBase(proto.base) { symbol, _, startOffset, endOffset, origin, fcode ->
|
withDeserializedIrDeclarationBase(proto.base) { symbol, _, startOffset, endOffset, origin, fcode ->
|
||||||
val flags = LocalVariableFlags.decode(fcode)
|
val flags = LocalVariableFlags.decode(fcode)
|
||||||
val nameType = BinaryNameAndType.decode(proto.nameType)
|
val nameType = BinaryNameAndType.decode(proto.nameType)
|
||||||
@@ -1197,7 +1197,7 @@ abstract class IrFileDeserializer(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun deserializeIrAnonymousInit(proto: ProtoAnonymousInit) =
|
private fun deserializeIrAnonymousInit(proto: ProtoAnonymousInit): IrAnonymousInitializer =
|
||||||
withDeserializedIrDeclarationBase(proto.base) { symbol, _, startOffset, endOffset, origin, _ ->
|
withDeserializedIrDeclarationBase(proto.base) { symbol, _, startOffset, endOffset, origin, _ ->
|
||||||
IrAnonymousInitializerImpl(startOffset, endOffset, origin, symbol as IrAnonymousInitializerSymbol).apply {
|
IrAnonymousInitializerImpl(startOffset, endOffset, origin, symbol as IrAnonymousInitializerSymbol).apply {
|
||||||
// body = deserializeBlockBody(proto.body.blockBody, startOffset, endOffset)
|
// body = deserializeBlockBody(proto.body.blockBody, startOffset, endOffset)
|
||||||
@@ -1207,7 +1207,7 @@ abstract class IrFileDeserializer(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun deserializeIrConstructor(proto: ProtoConstructor) =
|
private fun deserializeIrConstructor(proto: ProtoConstructor): IrConstructor =
|
||||||
withDeserializedIrFunctionBase(proto.base) { symbol, idSig, startOffset, endOffset, origin, fcode ->
|
withDeserializedIrFunctionBase(proto.base) { symbol, idSig, startOffset, endOffset, origin, fcode ->
|
||||||
val flags = FunctionFlags.decode(fcode)
|
val flags = FunctionFlags.decode(fcode)
|
||||||
val nameType = BinaryNameAndType.decode(proto.base.nameType)
|
val nameType = BinaryNameAndType.decode(proto.base.nameType)
|
||||||
@@ -1228,7 +1228,7 @@ abstract class IrFileDeserializer(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun deserializeIrField(proto: ProtoField) =
|
private fun deserializeIrField(proto: ProtoField): IrField =
|
||||||
withDeserializedIrDeclarationBase(proto.base) { symbol, uniqId, startOffset, endOffset, origin, fcode ->
|
withDeserializedIrDeclarationBase(proto.base) { symbol, uniqId, startOffset, endOffset, origin, fcode ->
|
||||||
val nameType = BinaryNameAndType.decode(proto.nameType)
|
val nameType = BinaryNameAndType.decode(proto.nameType)
|
||||||
val type = deserializeIrType(nameType.typeIndex)
|
val type = deserializeIrType(nameType.typeIndex)
|
||||||
@@ -1252,7 +1252,7 @@ abstract class IrFileDeserializer(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun deserializeIrLocalDelegatedProperty(proto: ProtoLocalDelegatedProperty) =
|
private fun deserializeIrLocalDelegatedProperty(proto: ProtoLocalDelegatedProperty): IrLocalDelegatedProperty =
|
||||||
withDeserializedIrDeclarationBase(proto.base) { symbol, _, startOffset, endOffset, origin, fcode ->
|
withDeserializedIrDeclarationBase(proto.base) { symbol, _, startOffset, endOffset, origin, fcode ->
|
||||||
val flags = LocalVariableFlags.decode(fcode)
|
val flags = LocalVariableFlags.decode(fcode)
|
||||||
val nameAndType = BinaryNameAndType.decode(proto.nameType)
|
val nameAndType = BinaryNameAndType.decode(proto.nameType)
|
||||||
@@ -1272,7 +1272,7 @@ abstract class IrFileDeserializer(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun deserializeIrProperty(proto: ProtoProperty) =
|
private fun deserializeIrProperty(proto: ProtoProperty): IrProperty =
|
||||||
withDeserializedIrDeclarationBase(proto.base) { symbol, uniqId, startOffset, endOffset, origin, fcode ->
|
withDeserializedIrDeclarationBase(proto.base) { symbol, uniqId, startOffset, endOffset, origin, fcode ->
|
||||||
val flags = PropertyFlags.decode(fcode)
|
val flags = PropertyFlags.decode(fcode)
|
||||||
symbolTable.declarePropertyFromLinker((symbol as IrPropertySymbol).descriptor, uniqId) {
|
symbolTable.declarePropertyFromLinker((symbol as IrPropertySymbol).descriptor, uniqId) {
|
||||||
@@ -1391,8 +1391,8 @@ abstract class IrFileDeserializer(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun deserializeDeclaration(proto: ProtoDeclaration, parent: IrDeclarationParent) =
|
fun deserializeDeclaration(proto: ProtoDeclaration, parent: IrDeclarationParent): IrDeclaration =
|
||||||
usingParent(parent) {
|
usingParent(parent) {
|
||||||
deserializeDeclaration(proto)
|
deserializeDeclaration(proto)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-3
@@ -18,14 +18,13 @@ import org.jetbrains.kotlin.backend.common.ir.createImplicitParameterDeclaration
|
|||||||
import org.jetbrains.kotlin.backend.common.lower.DeclarationIrBuilder
|
import org.jetbrains.kotlin.backend.common.lower.DeclarationIrBuilder
|
||||||
import org.jetbrains.kotlin.backend.common.lower.irBlock
|
import org.jetbrains.kotlin.backend.common.lower.irBlock
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
|
||||||
import org.jetbrains.kotlin.ir.IrStatement
|
import org.jetbrains.kotlin.ir.IrStatement
|
||||||
|
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||||
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
||||||
import org.jetbrains.kotlin.ir.builders.*
|
import org.jetbrains.kotlin.ir.builders.*
|
||||||
import org.jetbrains.kotlin.ir.builders.declarations.*
|
import org.jetbrains.kotlin.ir.builders.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.IrExternalPackageFragmentImpl
|
import org.jetbrains.kotlin.ir.declarations.impl.IrExternalPackageFragmentImpl
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl
|
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrCall
|
import org.jetbrains.kotlin.ir.expressions.IrCall
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrTypeOperator
|
import org.jetbrains.kotlin.ir.expressions.IrTypeOperator
|
||||||
@@ -75,7 +74,7 @@ private class AndroidIrTransformer(val extension: AndroidIrExtension, val plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createMethod(fqName: FqName, type: IrType, inInterface: Boolean = false, f: IrFunctionImpl.() -> Unit = {}) =
|
private fun createMethod(fqName: FqName, type: IrType, inInterface: Boolean = false, f: IrFunction.() -> Unit = {}) =
|
||||||
cachedMethods.getOrPut(fqName) {
|
cachedMethods.getOrPut(fqName) {
|
||||||
val parent = createClass(fqName.parent(), inInterface)
|
val parent = createClass(fqName.parent(), inInterface)
|
||||||
parent.addFunction {
|
parent.addFunction {
|
||||||
|
|||||||
+1
-1
@@ -381,7 +381,7 @@ interface IrBuilderExtension {
|
|||||||
copyTypeParameters: Boolean = true
|
copyTypeParameters: Boolean = true
|
||||||
) {
|
) {
|
||||||
val function = this
|
val function = this
|
||||||
fun irValueParameter(descriptor: ParameterDescriptor): IrValueParameterImpl = with(descriptor) {
|
fun irValueParameter(descriptor: ParameterDescriptor): IrValueParameter = with(descriptor) {
|
||||||
IrValueParameterImpl(
|
IrValueParameterImpl(
|
||||||
function.startOffset, function.endOffset, SERIALIZABLE_PLUGIN_ORIGIN, IrValueParameterSymbolImpl(this),
|
function.startOffset, function.endOffset, SERIALIZABLE_PLUGIN_ORIGIN, IrValueParameterSymbolImpl(this),
|
||||||
name, indexOrMinusOne, type.toIrType(), varargElementType?.toIrType(), isCrossinline, isNoinline
|
name, indexOrMinusOne, type.toIrType(), varargElementType?.toIrType(), isCrossinline, isNoinline
|
||||||
|
|||||||
Reference in New Issue
Block a user