[IR] Pass null instead of IrUninitializedType to IrFactory
#KT-66053 In progress
This commit is contained in:
committed by
Space Team
parent
1a4eaf796d
commit
d1e8016ab2
+2
-3
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -17,7 +17,6 @@ import org.jetbrains.kotlin.ir.expressions.impl.IrGetValueImpl
|
|||||||
import org.jetbrains.kotlin.ir.expressions.impl.IrReturnImpl
|
import org.jetbrains.kotlin.ir.expressions.impl.IrReturnImpl
|
||||||
import org.jetbrains.kotlin.ir.symbols.impl.IrSimpleFunctionSymbolImpl
|
import org.jetbrains.kotlin.ir.symbols.impl.IrSimpleFunctionSymbolImpl
|
||||||
import org.jetbrains.kotlin.ir.types.defaultType
|
import org.jetbrains.kotlin.ir.types.defaultType
|
||||||
import org.jetbrains.kotlin.ir.types.impl.IrUninitializedType
|
|
||||||
import org.jetbrains.kotlin.ir.util.DeepCopyIrTreeWithSymbols
|
import org.jetbrains.kotlin.ir.util.DeepCopyIrTreeWithSymbols
|
||||||
import org.jetbrains.kotlin.ir.util.DeepCopySymbolRemapper
|
import org.jetbrains.kotlin.ir.util.DeepCopySymbolRemapper
|
||||||
import org.jetbrains.kotlin.ir.util.SimpleTypeRemapper
|
import org.jetbrains.kotlin.ir.util.SimpleTypeRemapper
|
||||||
@@ -96,7 +95,7 @@ class SyntheticAccessorLowering(private val context: CommonBackendContext) : Bod
|
|||||||
visibility = DescriptorVisibilities.INTERNAL,
|
visibility = DescriptorVisibilities.INTERNAL,
|
||||||
isInline = declaration.isInline,
|
isInline = declaration.isInline,
|
||||||
isExpect = declaration.isExpect,
|
isExpect = declaration.isExpect,
|
||||||
returnType = IrUninitializedType,
|
returnType = null,
|
||||||
modality = declaration.modality,
|
modality = declaration.modality,
|
||||||
symbol = symbolRemapper.getDeclaredFunction(declaration.symbol),
|
symbol = symbolRemapper.getDeclaredFunction(declaration.symbol),
|
||||||
isTailrec = declaration.isTailrec,
|
isTailrec = declaration.isTailrec,
|
||||||
|
|||||||
+2
-3
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -17,7 +17,6 @@ import org.jetbrains.kotlin.ir.expressions.IrExpression
|
|||||||
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
|
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
|
||||||
import org.jetbrains.kotlin.ir.expressions.impl.*
|
import org.jetbrains.kotlin.ir.expressions.impl.*
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol
|
||||||
import org.jetbrains.kotlin.ir.types.impl.IrUninitializedType
|
|
||||||
import org.jetbrains.kotlin.ir.util.declareSimpleFunctionWithOverrides
|
import org.jetbrains.kotlin.ir.util.declareSimpleFunctionWithOverrides
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.psi.*
|
import org.jetbrains.kotlin.psi.*
|
||||||
@@ -297,7 +296,7 @@ internal class FunctionGenerator(declarationGenerator: DeclarationGenerator) : D
|
|||||||
visibility = visibility,
|
visibility = visibility,
|
||||||
isInline = isInline,
|
isInline = isInline,
|
||||||
isExpect = isExpect,
|
isExpect = isExpect,
|
||||||
returnType = IrUninitializedType,
|
returnType = null,
|
||||||
symbol = it,
|
symbol = it,
|
||||||
isPrimary = isPrimary,
|
isPrimary = isPrimary,
|
||||||
isExternal = isEffectivelyExternal(),
|
isExternal = isEffectivelyExternal(),
|
||||||
|
|||||||
+3
-4
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -11,7 +11,6 @@ import org.jetbrains.kotlin.ir.declarations.*
|
|||||||
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
|
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
|
||||||
import org.jetbrains.kotlin.ir.symbols.*
|
import org.jetbrains.kotlin.ir.symbols.*
|
||||||
import org.jetbrains.kotlin.ir.types.IrSimpleType
|
import org.jetbrains.kotlin.ir.types.IrSimpleType
|
||||||
import org.jetbrains.kotlin.ir.types.impl.IrUninitializedType
|
|
||||||
import org.jetbrains.kotlin.ir.util.createIrClassFromDescriptor
|
import org.jetbrains.kotlin.ir.util.createIrClassFromDescriptor
|
||||||
import org.jetbrains.kotlin.ir.util.withScope
|
import org.jetbrains.kotlin.ir.util.withScope
|
||||||
import org.jetbrains.kotlin.psi.KtParameter
|
import org.jetbrains.kotlin.psi.KtParameter
|
||||||
@@ -181,7 +180,7 @@ internal class StandaloneDeclarationGenerator(private val context: GeneratorCont
|
|||||||
visibility = visibility,
|
visibility = visibility,
|
||||||
isInline = isInline,
|
isInline = isInline,
|
||||||
isExpect = isExpect,
|
isExpect = isExpect,
|
||||||
returnType = IrUninitializedType,
|
returnType = null,
|
||||||
symbol = symbol,
|
symbol = symbol,
|
||||||
isPrimary = isPrimary,
|
isPrimary = isPrimary,
|
||||||
isExternal = isEffectivelyExternal(),
|
isExternal = isEffectivelyExternal(),
|
||||||
@@ -216,7 +215,7 @@ internal class StandaloneDeclarationGenerator(private val context: GeneratorCont
|
|||||||
visibility = visibility,
|
visibility = visibility,
|
||||||
isInline = isInline,
|
isInline = isInline,
|
||||||
isExpect = isExpect,
|
isExpect = isExpect,
|
||||||
returnType = IrUninitializedType,
|
returnType = null,
|
||||||
modality = modality,
|
modality = modality,
|
||||||
symbol = symbol,
|
symbol = symbol,
|
||||||
isTailrec = isTailrec,
|
isTailrec = isTailrec,
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ interface IrFactory {
|
|||||||
visibility: DescriptorVisibility,
|
visibility: DescriptorVisibility,
|
||||||
isInline: Boolean,
|
isInline: Boolean,
|
||||||
isExpect: Boolean,
|
isExpect: Boolean,
|
||||||
returnType: IrType,
|
returnType: IrType?,
|
||||||
symbol: IrConstructorSymbol,
|
symbol: IrConstructorSymbol,
|
||||||
isPrimary: Boolean,
|
isPrimary: Boolean,
|
||||||
isExternal: Boolean = false,
|
isExternal: Boolean = false,
|
||||||
@@ -99,7 +99,7 @@ interface IrFactory {
|
|||||||
visibility: DescriptorVisibility,
|
visibility: DescriptorVisibility,
|
||||||
isInline: Boolean,
|
isInline: Boolean,
|
||||||
isExpect: Boolean,
|
isExpect: Boolean,
|
||||||
returnType: IrType,
|
returnType: IrType?,
|
||||||
modality: Modality,
|
modality: Modality,
|
||||||
isTailrec: Boolean,
|
isTailrec: Boolean,
|
||||||
isSuspend: Boolean,
|
isSuspend: Boolean,
|
||||||
@@ -161,7 +161,7 @@ interface IrFactory {
|
|||||||
visibility: DescriptorVisibility,
|
visibility: DescriptorVisibility,
|
||||||
isInline: Boolean,
|
isInline: Boolean,
|
||||||
isExpect: Boolean,
|
isExpect: Boolean,
|
||||||
returnType: IrType,
|
returnType: IrType?,
|
||||||
modality: Modality,
|
modality: Modality,
|
||||||
symbol: IrSimpleFunctionSymbol,
|
symbol: IrSimpleFunctionSymbol,
|
||||||
isTailrec: Boolean,
|
isTailrec: Boolean,
|
||||||
|
|||||||
+2
-3
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -10,7 +10,6 @@ import org.jetbrains.kotlin.ir.declarations.IrConstructor
|
|||||||
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.types.IrType
|
import org.jetbrains.kotlin.ir.types.IrType
|
||||||
import org.jetbrains.kotlin.ir.types.impl.IrUninitializedType
|
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
||||||
|
|
||||||
class IrFunctionBuilder : IrDeclarationBuilder() {
|
class IrFunctionBuilder : IrDeclarationBuilder() {
|
||||||
@@ -18,7 +17,7 @@ class IrFunctionBuilder : IrDeclarationBuilder() {
|
|||||||
var isInline: Boolean = false
|
var isInline: Boolean = false
|
||||||
var isExternal: Boolean = false
|
var isExternal: Boolean = false
|
||||||
|
|
||||||
var returnType: IrType = IrUninitializedType
|
var returnType: IrType? = null
|
||||||
|
|
||||||
var modality: Modality = Modality.FINAL
|
var modality: Modality = Modality.FINAL
|
||||||
var isTailrec: Boolean = false
|
var isTailrec: Boolean = false
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import org.jetbrains.kotlin.ir.expressions.impl.IrBlockBodyImpl
|
|||||||
import org.jetbrains.kotlin.ir.expressions.impl.IrExpressionBodyImpl
|
import org.jetbrains.kotlin.ir.expressions.impl.IrExpressionBodyImpl
|
||||||
import org.jetbrains.kotlin.ir.symbols.*
|
import org.jetbrains.kotlin.ir.symbols.*
|
||||||
import org.jetbrains.kotlin.ir.types.IrType
|
import org.jetbrains.kotlin.ir.types.IrType
|
||||||
import org.jetbrains.kotlin.ir.types.impl.IrUninitializedType
|
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
||||||
import org.jetbrains.kotlin.types.Variance
|
import org.jetbrains.kotlin.types.Variance
|
||||||
@@ -94,7 +93,7 @@ abstract class AbstractIrFactoryImpl : IrFactory {
|
|||||||
visibility: DescriptorVisibility,
|
visibility: DescriptorVisibility,
|
||||||
isInline: Boolean,
|
isInline: Boolean,
|
||||||
isExpect: Boolean,
|
isExpect: Boolean,
|
||||||
returnType: IrType,
|
returnType: IrType?,
|
||||||
symbol: IrConstructorSymbol,
|
symbol: IrConstructorSymbol,
|
||||||
isPrimary: Boolean,
|
isPrimary: Boolean,
|
||||||
isExternal: Boolean,
|
isExternal: Boolean,
|
||||||
@@ -114,7 +113,7 @@ abstract class AbstractIrFactoryImpl : IrFactory {
|
|||||||
containerSource = containerSource,
|
containerSource = containerSource,
|
||||||
factory = this
|
factory = this
|
||||||
).apply {
|
).apply {
|
||||||
if (returnType != IrUninitializedType) {
|
if (returnType != null) {
|
||||||
this.returnType = returnType
|
this.returnType = returnType
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -184,7 +183,7 @@ abstract class AbstractIrFactoryImpl : IrFactory {
|
|||||||
visibility: DescriptorVisibility,
|
visibility: DescriptorVisibility,
|
||||||
isInline: Boolean,
|
isInline: Boolean,
|
||||||
isExpect: Boolean,
|
isExpect: Boolean,
|
||||||
returnType: IrType,
|
returnType: IrType?,
|
||||||
modality: Modality,
|
modality: Modality,
|
||||||
symbol: IrSimpleFunctionSymbol,
|
symbol: IrSimpleFunctionSymbol,
|
||||||
isTailrec: Boolean,
|
isTailrec: Boolean,
|
||||||
@@ -214,7 +213,7 @@ abstract class AbstractIrFactoryImpl : IrFactory {
|
|||||||
containerSource = containerSource,
|
containerSource = containerSource,
|
||||||
factory = this
|
factory = this
|
||||||
).apply {
|
).apply {
|
||||||
if (returnType != IrUninitializedType) {
|
if (returnType != null) {
|
||||||
this.returnType = returnType
|
this.returnType = returnType
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -227,7 +226,7 @@ abstract class AbstractIrFactoryImpl : IrFactory {
|
|||||||
visibility: DescriptorVisibility,
|
visibility: DescriptorVisibility,
|
||||||
isInline: Boolean,
|
isInline: Boolean,
|
||||||
isExpect: Boolean,
|
isExpect: Boolean,
|
||||||
returnType: IrType,
|
returnType: IrType?,
|
||||||
modality: Modality,
|
modality: Modality,
|
||||||
isTailrec: Boolean,
|
isTailrec: Boolean,
|
||||||
isSuspend: Boolean,
|
isSuspend: Boolean,
|
||||||
@@ -253,7 +252,7 @@ abstract class AbstractIrFactoryImpl : IrFactory {
|
|||||||
isFakeOverride = isFakeOverride,
|
isFakeOverride = isFakeOverride,
|
||||||
factory = this
|
factory = this
|
||||||
).apply {
|
).apply {
|
||||||
if (returnType != IrUninitializedType) {
|
if (returnType != null) {
|
||||||
this.returnType = returnType
|
this.returnType = returnType
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -94,11 +94,11 @@ class IrFactoryImplForJsIC(override val stageController: StageController) : Abst
|
|||||||
visibility: DescriptorVisibility,
|
visibility: DescriptorVisibility,
|
||||||
isInline: Boolean,
|
isInline: Boolean,
|
||||||
isExpect: Boolean,
|
isExpect: Boolean,
|
||||||
returnType: IrType,
|
returnType: IrType?,
|
||||||
symbol: IrConstructorSymbol,
|
symbol: IrConstructorSymbol,
|
||||||
isPrimary: Boolean,
|
isPrimary: Boolean,
|
||||||
isExternal: Boolean,
|
isExternal: Boolean,
|
||||||
containerSource: DeserializedContainerSource?
|
containerSource: DeserializedContainerSource?,
|
||||||
): IrConstructor {
|
): IrConstructor {
|
||||||
return super.createConstructor(
|
return super.createConstructor(
|
||||||
startOffset,
|
startOffset,
|
||||||
@@ -170,7 +170,7 @@ class IrFactoryImplForJsIC(override val stageController: StageController) : Abst
|
|||||||
visibility: DescriptorVisibility,
|
visibility: DescriptorVisibility,
|
||||||
isInline: Boolean,
|
isInline: Boolean,
|
||||||
isExpect: Boolean,
|
isExpect: Boolean,
|
||||||
returnType: IrType,
|
returnType: IrType?,
|
||||||
modality: Modality,
|
modality: Modality,
|
||||||
symbol: IrSimpleFunctionSymbol,
|
symbol: IrSimpleFunctionSymbol,
|
||||||
isTailrec: Boolean,
|
isTailrec: Boolean,
|
||||||
@@ -179,7 +179,7 @@ class IrFactoryImplForJsIC(override val stageController: StageController) : Abst
|
|||||||
isInfix: Boolean,
|
isInfix: Boolean,
|
||||||
isExternal: Boolean,
|
isExternal: Boolean,
|
||||||
containerSource: DeserializedContainerSource?,
|
containerSource: DeserializedContainerSource?,
|
||||||
isFakeOverride: Boolean
|
isFakeOverride: Boolean,
|
||||||
): IrSimpleFunction {
|
): IrSimpleFunction {
|
||||||
return super.createSimpleFunction(
|
return super.createSimpleFunction(
|
||||||
startOffset,
|
startOffset,
|
||||||
@@ -210,7 +210,7 @@ class IrFactoryImplForJsIC(override val stageController: StageController) : Abst
|
|||||||
visibility: DescriptorVisibility,
|
visibility: DescriptorVisibility,
|
||||||
isInline: Boolean,
|
isInline: Boolean,
|
||||||
isExpect: Boolean,
|
isExpect: Boolean,
|
||||||
returnType: IrType,
|
returnType: IrType?,
|
||||||
modality: Modality,
|
modality: Modality,
|
||||||
isTailrec: Boolean,
|
isTailrec: Boolean,
|
||||||
isSuspend: Boolean,
|
isSuspend: Boolean,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -69,11 +69,11 @@ class LazyIrFactory(
|
|||||||
visibility: DescriptorVisibility,
|
visibility: DescriptorVisibility,
|
||||||
isInline: Boolean,
|
isInline: Boolean,
|
||||||
isExpect: Boolean,
|
isExpect: Boolean,
|
||||||
returnType: IrType,
|
returnType: IrType?,
|
||||||
symbol: IrConstructorSymbol,
|
symbol: IrConstructorSymbol,
|
||||||
isPrimary: Boolean,
|
isPrimary: Boolean,
|
||||||
isExternal: Boolean,
|
isExternal: Boolean,
|
||||||
containerSource: DeserializedContainerSource?
|
containerSource: DeserializedContainerSource?,
|
||||||
): IrConstructor = if (symbol.isBound)
|
): IrConstructor = if (symbol.isBound)
|
||||||
symbol.owner
|
symbol.owner
|
||||||
else
|
else
|
||||||
@@ -127,7 +127,7 @@ class LazyIrFactory(
|
|||||||
visibility: DescriptorVisibility,
|
visibility: DescriptorVisibility,
|
||||||
isInline: Boolean,
|
isInline: Boolean,
|
||||||
isExpect: Boolean,
|
isExpect: Boolean,
|
||||||
returnType: IrType,
|
returnType: IrType?,
|
||||||
modality: Modality,
|
modality: Modality,
|
||||||
symbol: IrSimpleFunctionSymbol,
|
symbol: IrSimpleFunctionSymbol,
|
||||||
isTailrec: Boolean,
|
isTailrec: Boolean,
|
||||||
@@ -136,7 +136,7 @@ class LazyIrFactory(
|
|||||||
isInfix: Boolean,
|
isInfix: Boolean,
|
||||||
isExternal: Boolean,
|
isExternal: Boolean,
|
||||||
containerSource: DeserializedContainerSource?,
|
containerSource: DeserializedContainerSource?,
|
||||||
isFakeOverride: Boolean
|
isFakeOverride: Boolean,
|
||||||
): IrSimpleFunction = if (symbol.isBound)
|
): IrSimpleFunction = if (symbol.isBound)
|
||||||
symbol.owner
|
symbol.owner
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2000-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -12,7 +12,6 @@ import org.jetbrains.kotlin.ir.declarations.DescriptorMetadataSource
|
|||||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
|
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
|
||||||
import org.jetbrains.kotlin.ir.types.impl.IrUninitializedType
|
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.isEffectivelyExternal
|
import org.jetbrains.kotlin.resolve.descriptorUtil.isEffectivelyExternal
|
||||||
import org.jetbrains.kotlin.utils.memoryOptimizedMap
|
import org.jetbrains.kotlin.utils.memoryOptimizedMap
|
||||||
|
|
||||||
@@ -33,7 +32,7 @@ fun SymbolTable.declareSimpleFunctionWithOverrides(
|
|||||||
visibility = visibility,
|
visibility = visibility,
|
||||||
isInline = isInline,
|
isInline = isInline,
|
||||||
isExpect = isExpect,
|
isExpect = isExpect,
|
||||||
returnType = IrUninitializedType,
|
returnType = null,
|
||||||
modality = modality,
|
modality = modality,
|
||||||
symbol = it,
|
symbol = it,
|
||||||
isTailrec = isTailrec,
|
isTailrec = isTailrec,
|
||||||
|
|||||||
@@ -405,7 +405,9 @@ object IrTree : AbstractTreeBuilder() {
|
|||||||
// NB: there's an inline constructor for Array and each primitive array class.
|
// NB: there's an inline constructor for Array and each primitive array class.
|
||||||
+field("isInline", boolean)
|
+field("isInline", boolean)
|
||||||
+field("isExpect", boolean)
|
+field("isExpect", boolean)
|
||||||
+field("returnType", irTypeType)
|
+field("returnType", irTypeType) {
|
||||||
|
useFieldInIrFactory(customType = irTypeType.copy(nullable = true))
|
||||||
|
}
|
||||||
+field("dispatchReceiverParameter", valueParameter, nullable = true)
|
+field("dispatchReceiverParameter", valueParameter, nullable = true)
|
||||||
+field("extensionReceiverParameter", valueParameter, nullable = true)
|
+field("extensionReceiverParameter", valueParameter, nullable = true)
|
||||||
+listField("valueParameters", valueParameter, mutability = Var)
|
+listField("valueParameters", valueParameter, mutability = Var)
|
||||||
|
|||||||
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -25,8 +25,8 @@ abstract class AbstractTreeBuilder {
|
|||||||
customUseInIrFactoryStrategy = Field.UseFieldAsParameterInIrFactoryStrategy.No
|
customUseInIrFactoryStrategy = Field.UseFieldAsParameterInIrFactoryStrategy.No
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun Field.useFieldInIrFactory(defaultValue: String? = null) {
|
protected fun Field.useFieldInIrFactory(customType: TypeRef? = null, defaultValue: String? = null) {
|
||||||
customUseInIrFactoryStrategy = Field.UseFieldAsParameterInIrFactoryStrategy.Yes(defaultValue)
|
customUseInIrFactoryStrategy = Field.UseFieldAsParameterInIrFactoryStrategy.Yes(customType, defaultValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun element(category: Element.Category, name: String? = null, initializer: Element.() -> Unit = {}): ElementDelegate {
|
fun element(category: Element.Category, name: String? = null, initializer: Element.() -> Unit = {}): ElementDelegate {
|
||||||
|
|||||||
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ sealed class Field(
|
|||||||
|
|
||||||
data object No : UseFieldAsParameterInIrFactoryStrategy()
|
data object No : UseFieldAsParameterInIrFactoryStrategy()
|
||||||
|
|
||||||
data class Yes(val defaultValue: String?) : UseFieldAsParameterInIrFactoryStrategy()
|
data class Yes(val customType: TypeRef?, val defaultValue: String?) : UseFieldAsParameterInIrFactoryStrategy()
|
||||||
}
|
}
|
||||||
|
|
||||||
var customUseInIrFactoryStrategy: UseFieldAsParameterInIrFactoryStrategy? = null
|
var customUseInIrFactoryStrategy: UseFieldAsParameterInIrFactoryStrategy? = null
|
||||||
@@ -26,7 +26,7 @@ sealed class Field(
|
|||||||
?: if (isChild && containsElement) {
|
?: if (isChild && containsElement) {
|
||||||
UseFieldAsParameterInIrFactoryStrategy.No
|
UseFieldAsParameterInIrFactoryStrategy.No
|
||||||
} else {
|
} else {
|
||||||
UseFieldAsParameterInIrFactoryStrategy.Yes(null)
|
UseFieldAsParameterInIrFactoryStrategy.Yes(null, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ private class FactoryMethod(val element: Element) {
|
|||||||
.filterNot { it.name in element.fieldsToSkipInIrFactoryMethod }
|
.filterNot { it.name in element.fieldsToSkipInIrFactoryMethod }
|
||||||
.mapNotNull { field ->
|
.mapNotNull { field ->
|
||||||
(field.useInIrFactoryStrategy as? Field.UseFieldAsParameterInIrFactoryStrategy.Yes)?.let {
|
(field.useInIrFactoryStrategy as? Field.UseFieldAsParameterInIrFactoryStrategy.Yes)?.let {
|
||||||
FunctionParameter(field.name, field.typeRef, it.defaultValue)
|
FunctionParameter(field.name, it.customType ?: field.typeRef, it.defaultValue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.sortedBy { it.defaultValue != null } // All parameters with default values must go last
|
.sortedBy { it.defaultValue != null } // All parameters with default values must go last
|
||||||
|
|||||||
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -611,7 +611,7 @@ class IrDeclarationDeserializer(
|
|||||||
visibility = flags.visibility,
|
visibility = flags.visibility,
|
||||||
isInline = flags.isInline,
|
isInline = flags.isInline,
|
||||||
isExpect = flags.isExpect,
|
isExpect = flags.isExpect,
|
||||||
returnType = IrUninitializedType,
|
returnType = null,
|
||||||
modality = flags.modality,
|
modality = flags.modality,
|
||||||
symbol = it,
|
symbol = it,
|
||||||
isTailrec = flags.isTailrec,
|
isTailrec = flags.isTailrec,
|
||||||
@@ -685,7 +685,7 @@ class IrDeclarationDeserializer(
|
|||||||
visibility = flags.visibility,
|
visibility = flags.visibility,
|
||||||
isInline = flags.isInline,
|
isInline = flags.isInline,
|
||||||
isExpect = flags.isExpect,
|
isExpect = flags.isExpect,
|
||||||
returnType = IrUninitializedType,
|
returnType = null,
|
||||||
symbol = it,
|
symbol = it,
|
||||||
isPrimary = flags.isPrimary,
|
isPrimary = flags.isPrimary,
|
||||||
isExternal = flags.isExternal || isEffectivelyExternal,
|
isExternal = flags.isExternal || isEffectivelyExternal,
|
||||||
|
|||||||
+6
-2
@@ -1,3 +1,8 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.backend.konan.cgen
|
package org.jetbrains.kotlin.backend.konan.cgen
|
||||||
|
|
||||||
import org.jetbrains.kotlin.backend.common.lower.createIrBuilder
|
import org.jetbrains.kotlin.backend.common.lower.createIrBuilder
|
||||||
@@ -19,7 +24,6 @@ import org.jetbrains.kotlin.ir.expressions.impl.IrTryImpl
|
|||||||
import org.jetbrains.kotlin.ir.symbols.impl.IrSimpleFunctionSymbolImpl
|
import org.jetbrains.kotlin.ir.symbols.impl.IrSimpleFunctionSymbolImpl
|
||||||
import org.jetbrains.kotlin.ir.symbols.impl.IrValueParameterSymbolImpl
|
import org.jetbrains.kotlin.ir.symbols.impl.IrValueParameterSymbolImpl
|
||||||
import org.jetbrains.kotlin.ir.types.IrType
|
import org.jetbrains.kotlin.ir.types.IrType
|
||||||
import org.jetbrains.kotlin.ir.types.impl.IrUninitializedType
|
|
||||||
import org.jetbrains.kotlin.ir.util.constructors
|
import org.jetbrains.kotlin.ir.util.constructors
|
||||||
import org.jetbrains.kotlin.ir.util.simpleFunctions
|
import org.jetbrains.kotlin.ir.util.simpleFunctions
|
||||||
import org.jetbrains.kotlin.konan.ForeignExceptionMode
|
import org.jetbrains.kotlin.konan.ForeignExceptionMode
|
||||||
@@ -123,7 +127,7 @@ private fun createKotlinBridge(
|
|||||||
DescriptorVisibilities.PRIVATE,
|
DescriptorVisibilities.PRIVATE,
|
||||||
isInline = false,
|
isInline = false,
|
||||||
isExpect = false,
|
isExpect = false,
|
||||||
IrUninitializedType,
|
null,
|
||||||
Modality.FINAL,
|
Modality.FINAL,
|
||||||
IrSimpleFunctionSymbolImpl(),
|
IrSimpleFunctionSymbolImpl(),
|
||||||
isTailrec = false,
|
isTailrec = false,
|
||||||
|
|||||||
+3
-4
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* that can be found in the LICENSE file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
package org.jetbrains.kotlin.backend.konan.ir.interop
|
package org.jetbrains.kotlin.backend.konan.ir.interop
|
||||||
|
|
||||||
@@ -16,7 +16,6 @@ import org.jetbrains.kotlin.ir.expressions.IrExpression
|
|||||||
import org.jetbrains.kotlin.ir.expressions.impl.IrInstanceInitializerCallImpl
|
import org.jetbrains.kotlin.ir.expressions.impl.IrInstanceInitializerCallImpl
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||||
import org.jetbrains.kotlin.ir.types.impl.IrUninitializedType
|
|
||||||
import org.jetbrains.kotlin.ir.util.*
|
import org.jetbrains.kotlin.ir.util.*
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.*
|
import org.jetbrains.kotlin.resolve.descriptorUtil.*
|
||||||
import org.jetbrains.kotlin.types.KotlinType
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
@@ -95,7 +94,7 @@ internal interface DescriptorToIrTranslationMixin {
|
|||||||
visibility,
|
visibility,
|
||||||
isInline,
|
isInline,
|
||||||
isExpect,
|
isExpect,
|
||||||
IrUninitializedType,
|
null,
|
||||||
it,
|
it,
|
||||||
isPrimary,
|
isPrimary,
|
||||||
isEffectivelyExternal(),
|
isEffectivelyExternal(),
|
||||||
|
|||||||
Reference in New Issue
Block a user