Make descriptor-based API in ir:tree more granular
This commit is contained in:
+2
@@ -11,9 +11,11 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
|||||||
import org.jetbrains.kotlin.fir.backend.Fir2IrComponents
|
import org.jetbrains.kotlin.fir.backend.Fir2IrComponents
|
||||||
import org.jetbrains.kotlin.fir.resolve.firSymbolProvider
|
import org.jetbrains.kotlin.fir.resolve.firSymbolProvider
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.org.objectweb.asm.Type
|
import org.jetbrains.org.objectweb.asm.Type
|
||||||
|
|
||||||
class FirJvmBackendClassResolver(val components: Fir2IrComponents) : JvmBackendClassResolver {
|
class FirJvmBackendClassResolver(val components: Fir2IrComponents) : JvmBackendClassResolver {
|
||||||
|
@DescriptorBasedIr
|
||||||
override fun resolveToClassDescriptors(type: Type): List<ClassDescriptor> {
|
override fun resolveToClassDescriptors(type: Type): List<ClassDescriptor> {
|
||||||
if (type.sort != Type.OBJECT) return emptyList()
|
if (type.sort != Type.OBJECT) return emptyList()
|
||||||
|
|
||||||
|
|||||||
+2
@@ -30,6 +30,7 @@ import org.jetbrains.kotlin.fir.types.ConeKotlinErrorType
|
|||||||
import org.jetbrains.kotlin.fir.types.ConeKotlinType
|
import org.jetbrains.kotlin.fir.types.ConeKotlinType
|
||||||
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||||
import org.jetbrains.kotlin.fir.types.coneTypeUnsafe
|
import org.jetbrains.kotlin.fir.types.coneTypeUnsafe
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
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
|
||||||
@@ -96,6 +97,7 @@ class FirJvmClassCodegen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
override fun generateKotlinMetadataAnnotation() {
|
override fun generateKotlinMetadataAnnotation() {
|
||||||
|
|
||||||
val localDelegatedProperties = (irClass.attributeOwnerId as? IrClass)?.let(context.localDelegatedProperties::get)
|
val localDelegatedProperties = (irClass.attributeOwnerId as? IrClass)?.let(context.localDelegatedProperties::get)
|
||||||
|
|||||||
+2
@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.fir.serialization.FirElementSerializer
|
|||||||
import org.jetbrains.kotlin.fir.serialization.FirSerializerExtension
|
import org.jetbrains.kotlin.fir.serialization.FirSerializerExtension
|
||||||
import org.jetbrains.kotlin.fir.serialization.nonSourceAnnotations
|
import org.jetbrains.kotlin.fir.serialization.nonSourceAnnotations
|
||||||
import org.jetbrains.kotlin.fir.types.*
|
import org.jetbrains.kotlin.fir.types.*
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrClass
|
import org.jetbrains.kotlin.ir.declarations.IrClass
|
||||||
import org.jetbrains.kotlin.load.java.JvmAbi
|
import org.jetbrains.kotlin.load.java.JvmAbi
|
||||||
import org.jetbrains.kotlin.load.kotlin.NON_EXISTENT_CLASS_NAME
|
import org.jetbrains.kotlin.load.kotlin.NON_EXISTENT_CLASS_NAME
|
||||||
@@ -75,6 +76,7 @@ class FirJvmSerializerExtension @JvmOverloads constructor(
|
|||||||
return classBuilderMode != ClassBuilderMode.ABI || nestedClass.effectiveVisibility != FirEffectiveVisibilityImpl.Private
|
return classBuilderMode != ClassBuilderMode.ABI || nestedClass.effectiveVisibility != FirEffectiveVisibilityImpl.Private
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
override fun serializeClass(
|
override fun serializeClass(
|
||||||
klass: FirClass<*>,
|
klass: FirClass<*>,
|
||||||
proto: ProtoBuf.Class.Builder,
|
proto: ProtoBuf.Class.Builder,
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.fir.scopes.impl.FirClassSubstitutionScope
|
|||||||
import org.jetbrains.kotlin.fir.symbols.*
|
import org.jetbrains.kotlin.fir.symbols.*
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||||
import org.jetbrains.kotlin.fir.types.*
|
import org.jetbrains.kotlin.fir.types.*
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
||||||
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.*
|
||||||
@@ -45,6 +46,7 @@ import org.jetbrains.kotlin.name.FqName
|
|||||||
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
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
class Fir2IrDeclarationStorage(
|
class Fir2IrDeclarationStorage(
|
||||||
private val components: Fir2IrComponents,
|
private val components: Fir2IrComponents,
|
||||||
private val moduleDescriptor: FirModuleDescriptor,
|
private val moduleDescriptor: FirModuleDescriptor,
|
||||||
|
|||||||
+2
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.fir.types.impl.FirImplicitNullableAnyTypeRef
|
|||||||
import org.jetbrains.kotlin.fir.types.impl.FirImplicitStringTypeRef
|
import org.jetbrains.kotlin.fir.types.impl.FirImplicitStringTypeRef
|
||||||
import org.jetbrains.kotlin.fir.declarations.*
|
import org.jetbrains.kotlin.fir.declarations.*
|
||||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
||||||
import org.jetbrains.kotlin.ir.builders.IrGeneratorContextBase
|
import org.jetbrains.kotlin.ir.builders.IrGeneratorContextBase
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
@@ -50,6 +51,7 @@ import org.jetbrains.kotlin.name.Name
|
|||||||
* fir own logic that traverses class hierarchies in fir elements. Also, this one creates and passes IR elements, instead of providing how
|
* fir own logic that traverses class hierarchies in fir elements. Also, this one creates and passes IR elements, instead of providing how
|
||||||
* to declare them, to [DataClassMembersGenerator].
|
* to declare them, to [DataClassMembersGenerator].
|
||||||
*/
|
*/
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
class DataClassMembersGenerator(val components: Fir2IrComponents) {
|
class DataClassMembersGenerator(val components: Fir2IrComponents) {
|
||||||
|
|
||||||
fun generateInlineClassMembers(klass: FirClass<*>, irClass: IrClass): List<Name> =
|
fun generateInlineClassMembers(klass: FirClass<*>, irClass: IrClass): List<Name> =
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.fir.symbols
|
|||||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.SourceElement
|
import org.jetbrains.kotlin.descriptors.SourceElement
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.descriptors.*
|
import org.jetbrains.kotlin.ir.descriptors.*
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrBindableSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrBindableSymbol
|
||||||
@@ -36,6 +37,7 @@ abstract class Fir2IrBindableSymbol<out D : DeclarationDescriptor, B : IrSymbolO
|
|||||||
override val isBound: Boolean
|
override val isBound: Boolean
|
||||||
get() = _owner != null
|
get() = _owner != null
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
override val descriptor: D by lazy {
|
override val descriptor: D by lazy {
|
||||||
when (val owner = owner) {
|
when (val owner = owner) {
|
||||||
is IrEnumEntry -> WrappedEnumEntryDescriptor().apply { bind(owner) }
|
is IrEnumEntry -> WrappedEnumEntryDescriptor().apply { bind(owner) }
|
||||||
|
|||||||
+2
@@ -17,6 +17,7 @@
|
|||||||
package org.jetbrains.kotlin.backend.common
|
package org.jetbrains.kotlin.backend.common
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.IrElement
|
import org.jetbrains.kotlin.ir.IrElement
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrClass
|
import org.jetbrains.kotlin.ir.declarations.IrClass
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrFunction
|
import org.jetbrains.kotlin.ir.declarations.IrFunction
|
||||||
@@ -30,6 +31,7 @@ import java.util.*
|
|||||||
|
|
||||||
class Closure(val capturedValues: List<ValueDescriptor>)
|
class Closure(val capturedValues: List<ValueDescriptor>)
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
abstract class AbstractClosureAnnotator : IrElementVisitorVoid {
|
abstract class AbstractClosureAnnotator : IrElementVisitorVoid {
|
||||||
protected abstract fun recordFunctionClosure(functionDescriptor: FunctionDescriptor, closure: Closure)
|
protected abstract fun recordFunctionClosure(functionDescriptor: FunctionDescriptor, closure: Closure)
|
||||||
protected abstract fun recordClassClosure(classDescriptor: ClassDescriptor, closure: Closure)
|
protected abstract fun recordClassClosure(classDescriptor: ClassDescriptor, closure: Closure)
|
||||||
|
|||||||
+2
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.backend.common
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.VariableDescriptor
|
import org.jetbrains.kotlin.descriptors.VariableDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor
|
import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.IrElement
|
import org.jetbrains.kotlin.ir.IrElement
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrVariable
|
import org.jetbrains.kotlin.ir.declarations.IrVariable
|
||||||
import org.jetbrains.kotlin.ir.descriptors.WrappedVariableDescriptor
|
import org.jetbrains.kotlin.ir.descriptors.WrappedVariableDescriptor
|
||||||
@@ -29,6 +30,7 @@ import org.jetbrains.kotlin.ir.util.DescriptorsRemapper
|
|||||||
import org.jetbrains.kotlin.ir.visitors.acceptVoid
|
import org.jetbrains.kotlin.ir.visitors.acceptVoid
|
||||||
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
fun <T : IrElement> T.deepCopyWithVariables(): T {
|
fun <T : IrElement> T.deepCopyWithVariables(): T {
|
||||||
val descriptorsRemapper = object : DescriptorsRemapper {
|
val descriptorsRemapper = object : DescriptorsRemapper {
|
||||||
override fun remapDeclaredVariable(descriptor: VariableDescriptor) = WrappedVariableDescriptor()
|
override fun remapDeclaredVariable(descriptor: VariableDescriptor) = WrappedVariableDescriptor()
|
||||||
|
|||||||
+2
@@ -6,6 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.backend.common
|
package org.jetbrains.kotlin.backend.common
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.IrElement
|
import org.jetbrains.kotlin.ir.IrElement
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.descriptors.*
|
import org.jetbrains.kotlin.ir.descriptors.*
|
||||||
@@ -50,6 +51,7 @@ object DescriptorsToIrRemapper : DescriptorsRemapper {
|
|||||||
WrappedValueParameterDescriptor(descriptor.annotations, descriptor.source)
|
WrappedValueParameterDescriptor(descriptor.annotations, descriptor.source)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
object WrappedDescriptorPatcher : IrElementVisitorVoid {
|
object WrappedDescriptorPatcher : IrElementVisitorVoid {
|
||||||
override fun visitElement(element: IrElement) {
|
override fun visitElement(element: IrElement) {
|
||||||
element.acceptChildrenVoid(this)
|
element.acceptChildrenVoid(this)
|
||||||
|
|||||||
+4
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.backend.common
|
package org.jetbrains.kotlin.backend.common
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
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.builders.Scope
|
import org.jetbrains.kotlin.ir.builders.Scope
|
||||||
@@ -101,6 +102,7 @@ abstract class IrElementTransformerVoidWithContext : IrElementTransformerVoid()
|
|||||||
protected val allScopes get() = scopeStack
|
protected val allScopes get() = scopeStack
|
||||||
protected val currentDeclarationParent get() = scopeStack.lastOrNull { it.irElement is IrDeclarationParent }?.irElement as? IrDeclarationParent
|
protected val currentDeclarationParent get() = scopeStack.lastOrNull { it.irElement is IrDeclarationParent }?.irElement as? IrDeclarationParent
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
fun printScopeStack() {
|
fun printScopeStack() {
|
||||||
scopeStack.forEach { println(it.scope.scopeOwner) }
|
scopeStack.forEach { println(it.scope.scopeOwner) }
|
||||||
}
|
}
|
||||||
@@ -138,6 +140,7 @@ abstract class IrElementTransformerVoidWithContext : IrElementTransformerVoid()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
abstract class IrElementVisitorVoidWithContext : IrElementVisitorVoid {
|
abstract class IrElementVisitorVoidWithContext : IrElementVisitorVoid {
|
||||||
|
|
||||||
private val scopeStack = mutableListOf<ScopeWithIr>()
|
private val scopeStack = mutableListOf<ScopeWithIr>()
|
||||||
@@ -198,6 +201,7 @@ abstract class IrElementVisitorVoidWithContext : IrElementVisitorVoid {
|
|||||||
protected val parentScope get() = if (scopeStack.size < 2) null else scopeStack[scopeStack.size - 2]
|
protected val parentScope get() = if (scopeStack.size < 2) null else scopeStack[scopeStack.size - 2]
|
||||||
protected val allScopes get() = scopeStack
|
protected val allScopes get() = scopeStack
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
fun printScopeStack() {
|
fun printScopeStack() {
|
||||||
scopeStack.forEach { println(it.scope.scopeOwner) }
|
scopeStack.forEach { println(it.scope.scopeOwner) }
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.backend.common
|
package org.jetbrains.kotlin.backend.common
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.IrElement
|
import org.jetbrains.kotlin.ir.IrElement
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrClass
|
import org.jetbrains.kotlin.ir.declarations.IrClass
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrFunction
|
import org.jetbrains.kotlin.ir.declarations.IrFunction
|
||||||
@@ -34,6 +35,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
|||||||
* It is also not guaranteed that each returned call is detected as tail recursion by the frontend.
|
* It is also not guaranteed that each returned call is detected as tail recursion by the frontend.
|
||||||
* However any returned call can be correctly optimized as tail recursion.
|
* However any returned call can be correctly optimized as tail recursion.
|
||||||
*/
|
*/
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
fun collectTailRecursionCalls(irFunction: IrFunction): Set<IrCall> {
|
fun collectTailRecursionCalls(irFunction: IrFunction): Set<IrCall> {
|
||||||
if ((irFunction as? IrSimpleFunction)?.isTailrec != true) {
|
if ((irFunction as? IrSimpleFunction)?.isTailrec != true) {
|
||||||
return emptySet()
|
return emptySet()
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
|||||||
import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor
|
import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.findClassAcrossModuleDependencies
|
import org.jetbrains.kotlin.descriptors.findClassAcrossModuleDependencies
|
||||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrFunction
|
import org.jetbrains.kotlin.ir.declarations.IrFunction
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
|
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrPackageFragment
|
import org.jetbrains.kotlin.ir.declarations.IrPackageFragment
|
||||||
@@ -109,6 +110,8 @@ open class BuiltinSymbolsBase(protected val irBuiltIns: IrBuiltIns, protected va
|
|||||||
val intProgression = progression("IntProgression")
|
val intProgression = progression("IntProgression")
|
||||||
val longProgression = progression("LongProgression")
|
val longProgression = progression("LongProgression")
|
||||||
val progressionClasses = listOfNotNull(charProgression, intProgression, longProgression, uIntProgression, uLongProgression)
|
val progressionClasses = listOfNotNull(charProgression, intProgression, longProgression, uIntProgression, uLongProgression)
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
val progressionClassesTypes = progressionClasses.map { it.descriptor.defaultType }.toSet()
|
val progressionClassesTypes = progressionClasses.map { it.descriptor.defaultType }.toSet()
|
||||||
|
|
||||||
val getProgressionLastElementByReturnType = builtInsPackage("kotlin", "internal")
|
val getProgressionLastElementByReturnType = builtInsPackage("kotlin", "internal")
|
||||||
@@ -143,6 +146,8 @@ open class BuiltinSymbolsBase(protected val irBuiltIns: IrBuiltIns, protected va
|
|||||||
val long = symbolTable.referenceClass(builtIns.long)
|
val long = symbolTable.referenceClass(builtIns.long)
|
||||||
|
|
||||||
val integerClasses = listOf(byte, short, int, long)
|
val integerClasses = listOf(byte, short, int, long)
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
val integerClassesTypes = integerClasses.map { it.descriptor.defaultType }
|
val integerClassesTypes = integerClasses.map { it.descriptor.defaultType }
|
||||||
|
|
||||||
val arrayOf = getSimpleFunction(Name.identifier("arrayOf")) {
|
val arrayOf = getSimpleFunction(Name.identifier("arrayOf")) {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.backend.common.ir
|
package org.jetbrains.kotlin.backend.common.ir
|
||||||
|
|
||||||
import org.jetbrains.kotlin.backend.common.lower.VariableRemapper
|
import org.jetbrains.kotlin.backend.common.lower.VariableRemapper
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.IrStatement
|
import org.jetbrains.kotlin.ir.IrStatement
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.expressions.*
|
import org.jetbrains.kotlin.ir.expressions.*
|
||||||
@@ -86,6 +87,7 @@ private fun IrBody.move(
|
|||||||
|
|
||||||
// TODO use a generic inliner (e.g. JS/Native's FunctionInlining.Inliner)
|
// TODO use a generic inliner (e.g. JS/Native's FunctionInlining.Inliner)
|
||||||
// Inline simple function calls without type parameters, default parameters, or varargs.
|
// Inline simple function calls without type parameters, default parameters, or varargs.
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
fun IrFunction.inline(target: IrDeclarationParent, arguments: List<IrValueDeclaration> = listOf()): IrReturnableBlock =
|
fun IrFunction.inline(target: IrDeclarationParent, arguments: List<IrValueDeclaration> = listOf()): IrReturnableBlock =
|
||||||
IrReturnableBlockImpl(startOffset, endOffset, returnType, IrReturnableBlockSymbolImpl(descriptor), null, symbol).apply {
|
IrReturnableBlockImpl(startOffset, endOffset, returnType, IrReturnableBlockSymbolImpl(descriptor), null, symbol).apply {
|
||||||
statements += body!!.move(this@inline, target, symbol, valueParameters.zip(arguments).toMap()).statements
|
statements += body!!.move(this@inline, target, symbol, valueParameters.zip(arguments).toMap()).statements
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.descriptors.Modality
|
|||||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||||
import org.jetbrains.kotlin.descriptors.Visibility
|
import org.jetbrains.kotlin.descriptors.Visibility
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.IrElement
|
import org.jetbrains.kotlin.ir.IrElement
|
||||||
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
||||||
import org.jetbrains.kotlin.ir.builders.Scope
|
import org.jetbrains.kotlin.ir.builders.Scope
|
||||||
@@ -130,6 +131,7 @@ fun IrCall.getAnnotationClass(): IrClass {
|
|||||||
|
|
||||||
val IrTypeParametersContainer.classIfConstructor get() = if (this is IrConstructor) parentAsClass else this
|
val IrTypeParametersContainer.classIfConstructor get() = if (this is IrConstructor) parentAsClass else this
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
fun IrValueParameter.copyTo(
|
fun IrValueParameter.copyTo(
|
||||||
irFunction: IrFunction,
|
irFunction: IrFunction,
|
||||||
origin: IrDeclarationOrigin = this.origin,
|
origin: IrDeclarationOrigin = this.origin,
|
||||||
@@ -172,6 +174,7 @@ fun IrValueParameter.copyTo(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
fun IrTypeParameter.copyToWithoutSuperTypes(
|
fun IrTypeParameter.copyToWithoutSuperTypes(
|
||||||
target: IrTypeParametersContainer,
|
target: IrTypeParametersContainer,
|
||||||
index: Int = this.index,
|
index: Int = this.index,
|
||||||
@@ -185,6 +188,7 @@ fun IrTypeParameter.copyToWithoutSuperTypes(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
fun IrFunction.copyReceiverParametersFrom(from: IrFunction) {
|
fun IrFunction.copyReceiverParametersFrom(from: IrFunction) {
|
||||||
dispatchReceiverParameter = from.dispatchReceiverParameter?.let {
|
dispatchReceiverParameter = from.dispatchReceiverParameter?.let {
|
||||||
IrValueParameterImpl(it.startOffset, it.endOffset, it.origin, it.descriptor, it.type, it.varargElementType).also {
|
IrValueParameterImpl(it.startOffset, it.endOffset, it.origin, it.descriptor, it.type, it.varargElementType).also {
|
||||||
@@ -457,6 +461,7 @@ fun IrClass.createParameterDeclarations() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
fun IrFunction.createDispatchReceiverParameter(origin: IrDeclarationOrigin? = null) {
|
fun IrFunction.createDispatchReceiverParameter(origin: IrDeclarationOrigin? = null) {
|
||||||
assert(dispatchReceiverParameter == null)
|
assert(dispatchReceiverParameter == null)
|
||||||
|
|
||||||
@@ -479,7 +484,7 @@ val IrFunction.allParameters: List<IrValueParameter>
|
|||||||
get() = if (this is IrConstructor) {
|
get() = if (this is IrConstructor) {
|
||||||
listOf(
|
listOf(
|
||||||
this.constructedClass.thisReceiver
|
this.constructedClass.thisReceiver
|
||||||
?: error(this.descriptor)
|
?: error(this.render())
|
||||||
) + explicitParameters
|
) + explicitParameters
|
||||||
} else {
|
} else {
|
||||||
explicitParameters
|
explicitParameters
|
||||||
@@ -548,6 +553,7 @@ fun IrClass.addFakeOverridesViaIncorrectHeuristic(implementedMembers: List<IrSim
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
fun createStaticFunctionWithReceivers(
|
fun createStaticFunctionWithReceivers(
|
||||||
irParent: IrDeclarationParent,
|
irParent: IrDeclarationParent,
|
||||||
name: Name,
|
name: Name,
|
||||||
|
|||||||
+2
@@ -10,6 +10,7 @@ import org.jetbrains.kotlin.backend.common.ir.*
|
|||||||
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.descriptors.Visibilities
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.IrElement
|
import org.jetbrains.kotlin.ir.IrElement
|
||||||
import org.jetbrains.kotlin.ir.builders.*
|
import org.jetbrains.kotlin.ir.builders.*
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
@@ -38,6 +39,7 @@ import org.jetbrains.kotlin.ir.util.*
|
|||||||
import org.jetbrains.kotlin.ir.visitors.*
|
import org.jetbrains.kotlin.ir.visitors.*
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
abstract class AbstractSuspendFunctionsLowering<C : CommonBackendContext>(val context: C) : FileLoweringPass {
|
abstract class AbstractSuspendFunctionsLowering<C : CommonBackendContext>(val context: C) : FileLoweringPass {
|
||||||
|
|
||||||
protected object STATEMENT_ORIGIN_COROUTINE_IMPL : IrStatementOriginImpl("COROUTINE_IMPL")
|
protected object STATEMENT_ORIGIN_COROUTINE_IMPL : IrStatementOriginImpl("COROUTINE_IMPL")
|
||||||
|
|||||||
+19
-3
@@ -11,6 +11,7 @@ import org.jetbrains.kotlin.backend.common.ir.*
|
|||||||
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.descriptors.Visibility
|
import org.jetbrains.kotlin.descriptors.Visibility
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
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.addValueParameter
|
import org.jetbrains.kotlin.ir.builders.declarations.addValueParameter
|
||||||
@@ -282,7 +283,11 @@ open class DefaultParameterInjector(
|
|||||||
expression.transformChildrenVoid()
|
expression.transformChildrenVoid()
|
||||||
return visitFunctionAccessExpression(expression) {
|
return visitFunctionAccessExpression(expression) {
|
||||||
with(expression) {
|
with(expression) {
|
||||||
IrDelegatingConstructorCallImpl(startOffset, endOffset, type, it as IrConstructorSymbol, typeArgumentsCount)
|
IrDelegatingConstructorCallImpl(
|
||||||
|
startOffset, endOffset, type, it as IrConstructorSymbol,
|
||||||
|
typeArgumentsCount = typeArgumentsCount,
|
||||||
|
valueArgumentsCount = it.owner.valueParameters.size
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -300,7 +305,11 @@ open class DefaultParameterInjector(
|
|||||||
expression.transformChildrenVoid()
|
expression.transformChildrenVoid()
|
||||||
return visitFunctionAccessExpression(expression) {
|
return visitFunctionAccessExpression(expression) {
|
||||||
with(expression) {
|
with(expression) {
|
||||||
IrEnumConstructorCallImpl(startOffset, endOffset, type, it as IrConstructorSymbol)
|
IrEnumConstructorCallImpl(
|
||||||
|
startOffset, endOffset, type, it as IrConstructorSymbol,
|
||||||
|
typeArgumentsCount = typeArgumentsCount,
|
||||||
|
valueArgumentsCount = it.owner.valueParameters.size
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -309,7 +318,13 @@ open class DefaultParameterInjector(
|
|||||||
expression.transformChildrenVoid()
|
expression.transformChildrenVoid()
|
||||||
return visitFunctionAccessExpression(expression) {
|
return visitFunctionAccessExpression(expression) {
|
||||||
with(expression) {
|
with(expression) {
|
||||||
IrCallImpl(startOffset, endOffset, type, it, typeArgumentsCount, DEFAULT_DISPATCH_CALL, superQualifierSymbol)
|
IrCallImpl(
|
||||||
|
startOffset, endOffset, type, it,
|
||||||
|
typeArgumentsCount = typeArgumentsCount,
|
||||||
|
valueArgumentsCount = it.owner.valueParameters.size,
|
||||||
|
origin = DEFAULT_DISPATCH_CALL,
|
||||||
|
superQualifierSymbol = superQualifierSymbol
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -480,6 +495,7 @@ private fun IrFunction.generateDefaultsFunction(
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
private fun IrFunction.generateDefaultsFunctionImpl(
|
private fun IrFunction.generateDefaultsFunctionImpl(
|
||||||
context: CommonBackendContext,
|
context: CommonBackendContext,
|
||||||
newOrigin: IrDeclarationOrigin,
|
newOrigin: IrDeclarationOrigin,
|
||||||
|
|||||||
+6
-1
@@ -102,7 +102,12 @@ open class EnumWhenLowering(protected val context: CommonBackendContext) : IrEle
|
|||||||
else -> return super.visitCall(expression)
|
else -> return super.visitCall(expression)
|
||||||
}
|
}
|
||||||
val subjectOrdinal = topmostOrdinalProvider.value
|
val subjectOrdinal = topmostOrdinalProvider.value
|
||||||
return IrCallImpl(expression.startOffset, expression.endOffset, expression.type, expression.symbol).apply {
|
return IrCallImpl(
|
||||||
|
expression.startOffset, expression.endOffset,
|
||||||
|
expression.type, expression.symbol,
|
||||||
|
typeArgumentsCount = 0,
|
||||||
|
valueArgumentsCount = 2
|
||||||
|
).apply {
|
||||||
putValueArgument(0, IrGetValueImpl(lhs.startOffset, lhs.endOffset, subjectOrdinal.type, subjectOrdinal.symbol))
|
putValueArgument(0, IrGetValueImpl(lhs.startOffset, lhs.endOffset, subjectOrdinal.type, subjectOrdinal.symbol))
|
||||||
putValueArgument(1, IrConstImpl.int(rhs.startOffset, rhs.endOffset, context.irBuiltIns.intType, entryOrdinal))
|
putValueArgument(1, IrConstImpl.int(rhs.startOffset, rhs.endOffset, context.irBuiltIns.intType, entryOrdinal))
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-6
@@ -17,13 +17,11 @@ import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol
|
|||||||
import org.jetbrains.kotlin.ir.symbols.IrValueParameterSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrValueParameterSymbol
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrValueSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrValueSymbol
|
||||||
import org.jetbrains.kotlin.ir.types.classOrNull
|
import org.jetbrains.kotlin.ir.types.classOrNull
|
||||||
import org.jetbrains.kotlin.ir.util.deepCopyWithSymbols
|
|
||||||
import org.jetbrains.kotlin.ir.util.dump
|
import org.jetbrains.kotlin.ir.util.dump
|
||||||
import org.jetbrains.kotlin.ir.util.parentAsClass
|
import org.jetbrains.kotlin.ir.util.parentAsClass
|
||||||
import org.jetbrains.kotlin.ir.util.patchDeclarationParents
|
import org.jetbrains.kotlin.ir.util.patchDeclarationParents
|
||||||
import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
|
import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
|
||||||
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
|
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.cast
|
|
||||||
|
|
||||||
class InnerClassesLowering(val context: BackendContext) : DeclarationTransformer {
|
class InnerClassesLowering(val context: BackendContext) : DeclarationTransformer {
|
||||||
|
|
||||||
@@ -225,7 +223,9 @@ class InnerClassConstructorCallsLowering(val context: BackendContext) : BodyLowe
|
|||||||
|
|
||||||
val newCallee = context.declarationFactory.getInnerClassConstructorWithOuterThisParameter(classConstructor)
|
val newCallee = context.declarationFactory.getInnerClassConstructorWithOuterThisParameter(classConstructor)
|
||||||
val newCall = IrDelegatingConstructorCallImpl(
|
val newCall = IrDelegatingConstructorCallImpl(
|
||||||
expression.startOffset, expression.endOffset, context.irBuiltIns.unitType, newCallee.symbol, expression.typeArgumentsCount
|
expression.startOffset, expression.endOffset, context.irBuiltIns.unitType, newCallee.symbol,
|
||||||
|
typeArgumentsCount = expression.typeArgumentsCount,
|
||||||
|
valueArgumentsCount = newCallee.valueParameters.size
|
||||||
).apply { copyTypeArgumentsFrom(expression) }
|
).apply { copyTypeArgumentsFrom(expression) }
|
||||||
|
|
||||||
newCall.putValueArgument(0, dispatchReceiver)
|
newCall.putValueArgument(0, dispatchReceiver)
|
||||||
@@ -258,9 +258,10 @@ class InnerClassConstructorCallsLowering(val context: BackendContext) : BodyLowe
|
|||||||
endOffset,
|
endOffset,
|
||||||
type,
|
type,
|
||||||
newCallee.symbol,
|
newCallee.symbol,
|
||||||
typeArgumentsCount,
|
typeArgumentsCount = typeArgumentsCount,
|
||||||
newReflectionTarget?.symbol,
|
valueArgumentsCount = newCallee.valueParameters.size,
|
||||||
origin
|
reflectionTarget = newReflectionTarget?.symbol,
|
||||||
|
origin = origin
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-8
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.descriptors.Modality
|
|||||||
import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor
|
import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||||
import org.jetbrains.kotlin.descriptors.Visibility
|
import org.jetbrains.kotlin.descriptors.Visibility
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
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.UNDEFINED_OFFSET
|
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
||||||
@@ -47,7 +48,6 @@ import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid
|
|||||||
import org.jetbrains.kotlin.ir.visitors.acceptVoid
|
import org.jetbrains.kotlin.ir.visitors.acceptVoid
|
||||||
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
|
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
interface LocalNameProvider {
|
interface LocalNameProvider {
|
||||||
@@ -229,6 +229,7 @@ class LocalDeclarationsLowering(
|
|||||||
abbreviation.annotations
|
abbreviation.annotations
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
private inner class LocalDeclarationsTransformer(
|
private inner class LocalDeclarationsTransformer(
|
||||||
val irElement: IrElement, val container: IrDeclaration, val classesToLower: Set<IrClass>?
|
val irElement: IrElement, val container: IrDeclaration, val classesToLower: Set<IrClass>?
|
||||||
) {
|
) {
|
||||||
@@ -358,7 +359,8 @@ class LocalDeclarationsLowering(
|
|||||||
expression.startOffset, expression.endOffset,
|
expression.startOffset, expression.endOffset,
|
||||||
context.irBuiltIns.unitType,
|
context.irBuiltIns.unitType,
|
||||||
newCallee.symbol,
|
newCallee.symbol,
|
||||||
expression.typeArgumentsCount
|
typeArgumentsCount = expression.typeArgumentsCount,
|
||||||
|
valueArgumentsCount = newCallee.valueParameters.size
|
||||||
).also {
|
).also {
|
||||||
it.fillArguments2(expression, newCallee)
|
it.fillArguments2(expression, newCallee)
|
||||||
it.copyTypeArgumentsFrom(expression)
|
it.copyTypeArgumentsFrom(expression)
|
||||||
@@ -416,9 +418,10 @@ class LocalDeclarationsLowering(
|
|||||||
expression.startOffset, expression.endOffset,
|
expression.startOffset, expression.endOffset,
|
||||||
expression.type, // TODO functional type for transformed descriptor
|
expression.type, // TODO functional type for transformed descriptor
|
||||||
newCallee.symbol,
|
newCallee.symbol,
|
||||||
newCallee.typeParameters.size,
|
typeArgumentsCount = newCallee.typeParameters.size,
|
||||||
newReflectionTarget?.symbol,
|
valueArgumentsCount = newCallee.valueParameters.size,
|
||||||
expression.origin
|
reflectionTarget = newReflectionTarget?.symbol,
|
||||||
|
origin = expression.origin
|
||||||
).also {
|
).also {
|
||||||
it.fillArguments2(expression, newCallee)
|
it.fillArguments2(expression, newCallee)
|
||||||
it.setLocalTypeArguments(oldCallee)
|
it.setLocalTypeArguments(oldCallee)
|
||||||
@@ -519,9 +522,10 @@ class LocalDeclarationsLowering(
|
|||||||
oldCall.startOffset, oldCall.endOffset,
|
oldCall.startOffset, oldCall.endOffset,
|
||||||
newCallee.returnType,
|
newCallee.returnType,
|
||||||
newCallee.symbol,
|
newCallee.symbol,
|
||||||
newCallee.typeParameters.size,
|
typeArgumentsCount = newCallee.typeParameters.size,
|
||||||
oldCall.origin,
|
valueArgumentsCount = newCallee.valueParameters.size,
|
||||||
oldCall.superQualifierSymbol
|
origin = oldCall.origin,
|
||||||
|
superQualifierSymbol = oldCall.superQualifierSymbol
|
||||||
).also {
|
).also {
|
||||||
it.setLocalTypeArguments(oldCall.symbol.owner)
|
it.setLocalTypeArguments(oldCall.symbol.owner)
|
||||||
it.copyTypeArgumentsFrom(oldCall, shift = newCallee.typeParameters.size - oldCall.typeArgumentsCount)
|
it.copyTypeArgumentsFrom(oldCall, shift = newCallee.typeParameters.size - oldCall.typeArgumentsCount)
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.backend.common.lower
|
|||||||
import org.jetbrains.kotlin.backend.common.BackendContext
|
import org.jetbrains.kotlin.backend.common.BackendContext
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl
|
import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
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.UNDEFINED_OFFSET
|
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
||||||
@@ -63,6 +64,7 @@ open class VariableRemapper(val mapping: Map<IrValueParameter, IrValueDeclaratio
|
|||||||
mapping[value]
|
mapping[value]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
class VariableRemapperDesc(val mapping: Map<ValueDescriptor, IrValueParameter>) : AbstractVariableRemapper() {
|
class VariableRemapperDesc(val mapping: Map<ValueDescriptor, IrValueParameter>) : AbstractVariableRemapper() {
|
||||||
override fun remapVariable(value: IrValueDeclaration): IrValueDeclaration? =
|
override fun remapVariable(value: IrValueDeclaration): IrValueDeclaration? =
|
||||||
mapping[value.descriptor]
|
mapping[value.descriptor]
|
||||||
@@ -158,6 +160,7 @@ open class IrBuildingTransformer(private val context: BackendContext) : IrElemen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
fun IrConstructor.callsSuper(irBuiltIns: IrBuiltIns): Boolean {
|
fun IrConstructor.callsSuper(irBuiltIns: IrBuiltIns): Boolean {
|
||||||
val constructedClass = parent as IrClass
|
val constructedClass = parent as IrClass
|
||||||
val superClass = constructedClass.superTypes
|
val superClass = constructedClass.superTypes
|
||||||
|
|||||||
+1
@@ -42,6 +42,7 @@ class ProvisionalFunctionExpressionLowering :
|
|||||||
startOffset, endOffset, type,
|
startOffset, endOffset, type,
|
||||||
function.symbol,
|
function.symbol,
|
||||||
typeArgumentsCount = 0,
|
typeArgumentsCount = 0,
|
||||||
|
valueArgumentsCount = function.valueParameters.size,
|
||||||
reflectionTarget = null,
|
reflectionTarget = null,
|
||||||
origin = origin
|
origin = origin
|
||||||
)
|
)
|
||||||
|
|||||||
+4
-5
@@ -11,6 +11,7 @@ import org.jetbrains.kotlin.backend.common.ir.Symbols
|
|||||||
import org.jetbrains.kotlin.backend.common.ir.createTemporaryVariableWithWrappedDescriptor
|
import org.jetbrains.kotlin.backend.common.ir.createTemporaryVariableWithWrappedDescriptor
|
||||||
import org.jetbrains.kotlin.backend.common.lower.createIrBuilder
|
import org.jetbrains.kotlin.backend.common.lower.createIrBuilder
|
||||||
import org.jetbrains.kotlin.config.languageVersionSettings
|
import org.jetbrains.kotlin.config.languageVersionSettings
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
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.UNDEFINED_OFFSET
|
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
||||||
@@ -36,6 +37,7 @@ interface InlineFunctionResolver {
|
|||||||
fun getFunctionDeclaration(symbol: IrFunctionSymbol): IrFunction
|
fun getFunctionDeclaration(symbol: IrFunctionSymbol): IrFunction
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
open class DefaultInlineFunctionResolver(open val context: CommonBackendContext) : InlineFunctionResolver {
|
open class DefaultInlineFunctionResolver(open val context: CommonBackendContext) : InlineFunctionResolver {
|
||||||
override fun getFunctionDeclaration(symbol: IrFunctionSymbol): IrFunction {
|
override fun getFunctionDeclaration(symbol: IrFunctionSymbol): IrFunction {
|
||||||
val descriptor = symbol.descriptor.original
|
val descriptor = symbol.descriptor.original
|
||||||
@@ -56,6 +58,7 @@ open class DefaultInlineFunctionResolver(open val context: CommonBackendContext)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
class FunctionInlining(
|
class FunctionInlining(
|
||||||
val context: CommonBackendContext,
|
val context: CommonBackendContext,
|
||||||
val inlineFunctionResolver: InlineFunctionResolver
|
val inlineFunctionResolver: InlineFunctionResolver
|
||||||
@@ -164,10 +167,6 @@ class FunctionInlining(
|
|||||||
statements.transform { it.transform(transformer, data = null) }
|
statements.transform { it.transform(transformer, data = null) }
|
||||||
statements.addAll(0, evaluationStatements)
|
statements.addAll(0, evaluationStatements)
|
||||||
|
|
||||||
val isCoroutineIntrinsicCall = callSite.symbol.descriptor.isBuiltInSuspendCoroutineUninterceptedOrReturn(
|
|
||||||
context.configuration.languageVersionSettings
|
|
||||||
)
|
|
||||||
|
|
||||||
return IrReturnableBlockImpl(
|
return IrReturnableBlockImpl(
|
||||||
startOffset = callSite.startOffset,
|
startOffset = callSite.startOffset,
|
||||||
endOffset = callSite.endOffset,
|
endOffset = callSite.endOffset,
|
||||||
@@ -414,7 +413,7 @@ class FunctionInlining(
|
|||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
val message = "Incomplete expression: call to ${callee.descriptor} " +
|
val message = "Incomplete expression: call to ${callee.render()} " +
|
||||||
"has no argument at index ${parameter.index}"
|
"has no argument at index ${parameter.index}"
|
||||||
throw Error(message)
|
throw Error(message)
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.backend.common.lower.matchers.Quantifier
|
|||||||
import org.jetbrains.kotlin.backend.common.lower.matchers.SimpleCalleeMatcher
|
import org.jetbrains.kotlin.backend.common.lower.matchers.SimpleCalleeMatcher
|
||||||
import org.jetbrains.kotlin.backend.common.lower.matchers.createIrCallMatcher
|
import org.jetbrains.kotlin.backend.common.lower.matchers.createIrCallMatcher
|
||||||
import org.jetbrains.kotlin.backend.common.lower.matchers.singleArgumentExtension
|
import org.jetbrains.kotlin.backend.common.lower.matchers.singleArgumentExtension
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.builders.*
|
import org.jetbrains.kotlin.ir.builders.*
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
|
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrVariable
|
import org.jetbrains.kotlin.ir.declarations.IrVariable
|
||||||
@@ -555,6 +556,7 @@ internal class CharSequenceIndicesHandler(context: CommonBackendContext) : Indic
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Builds a [HeaderInfo] for calls to reverse an iterable. */
|
/** Builds a [HeaderInfo] for calls to reverse an iterable. */
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
internal class ReversedHandler(context: CommonBackendContext, private val visitor: HeaderInfoBuilder) :
|
internal class ReversedHandler(context: CommonBackendContext, private val visitor: HeaderInfoBuilder) :
|
||||||
HeaderInfoFromCallHandler<Nothing?> {
|
HeaderInfoFromCallHandler<Nothing?> {
|
||||||
|
|
||||||
|
|||||||
+28
-5
@@ -10,6 +10,7 @@ package org.jetbrains.kotlin.backend.common.lower.loops
|
|||||||
import org.jetbrains.kotlin.backend.common.CommonBackendContext
|
import org.jetbrains.kotlin.backend.common.CommonBackendContext
|
||||||
import org.jetbrains.kotlin.backend.common.ir.Symbols
|
import org.jetbrains.kotlin.backend.common.ir.Symbols
|
||||||
import org.jetbrains.kotlin.backend.common.lower.DeclarationIrBuilder
|
import org.jetbrains.kotlin.backend.common.lower.DeclarationIrBuilder
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.builders.irChar
|
import org.jetbrains.kotlin.ir.builders.irChar
|
||||||
import org.jetbrains.kotlin.ir.builders.irInt
|
import org.jetbrains.kotlin.ir.builders.irInt
|
||||||
import org.jetbrains.kotlin.ir.builders.irLong
|
import org.jetbrains.kotlin.ir.builders.irLong
|
||||||
@@ -48,8 +49,12 @@ internal sealed class ProgressionType(
|
|||||||
it.name == numberCastFunctionName &&
|
it.name == numberCastFunctionName &&
|
||||||
it.dispatchReceiverParameter != null && it.extensionReceiverParameter == null && it.valueParameters.isEmpty()
|
it.dispatchReceiverParameter != null && it.extensionReceiverParameter == null && it.valueParameters.isEmpty()
|
||||||
}
|
}
|
||||||
IrCallImpl(startOffset, endOffset, castFun.returnType, castFun.symbol)
|
IrCallImpl(
|
||||||
.apply { dispatchReceiver = this@castIfNecessary }
|
startOffset, endOffset,
|
||||||
|
castFun.returnType, castFun.symbol,
|
||||||
|
typeArgumentsCount = 0,
|
||||||
|
valueArgumentsCount = 0
|
||||||
|
).apply { dispatchReceiver = this@castIfNecessary }
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@@ -139,14 +144,25 @@ internal abstract class UnsignedProgressionType(
|
|||||||
if (type == unsignedType) return this
|
if (type == unsignedType) return this
|
||||||
|
|
||||||
return if (unsafeCoerceIntrinsic != null) {
|
return if (unsafeCoerceIntrinsic != null) {
|
||||||
IrCallImpl(startOffset, endOffset, unsignedType, unsafeCoerceIntrinsic).apply {
|
IrCallImpl(
|
||||||
|
startOffset, endOffset,
|
||||||
|
unsignedType,
|
||||||
|
unsafeCoerceIntrinsic,
|
||||||
|
typeArgumentsCount = 2,
|
||||||
|
valueArgumentsCount = 1
|
||||||
|
).apply {
|
||||||
putTypeArgument(0, fromType)
|
putTypeArgument(0, fromType)
|
||||||
putTypeArgument(1, unsignedType)
|
putTypeArgument(1, unsignedType)
|
||||||
putValueArgument(0, this@asUnsigned)
|
putValueArgument(0, this@asUnsigned)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Fallback to calling `toUInt/ULong()` extension function.
|
// Fallback to calling `toUInt/ULong()` extension function.
|
||||||
IrCallImpl(startOffset, endOffset, unsignedConversionFunction.owner.returnType, unsignedConversionFunction).apply {
|
IrCallImpl(
|
||||||
|
startOffset, endOffset, unsignedConversionFunction.owner.returnType,
|
||||||
|
unsignedConversionFunction,
|
||||||
|
typeArgumentsCount = 0,
|
||||||
|
valueArgumentsCount = 0
|
||||||
|
).apply {
|
||||||
extensionReceiver = this@asUnsigned
|
extensionReceiver = this@asUnsigned
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -157,7 +173,12 @@ internal abstract class UnsignedProgressionType(
|
|||||||
if (type == toType) return this
|
if (type == toType) return this
|
||||||
|
|
||||||
return if (unsafeCoerceIntrinsic != null) {
|
return if (unsafeCoerceIntrinsic != null) {
|
||||||
IrCallImpl(startOffset, endOffset, toType, unsafeCoerceIntrinsic).apply {
|
IrCallImpl(
|
||||||
|
startOffset, endOffset, toType,
|
||||||
|
unsafeCoerceIntrinsic,
|
||||||
|
typeArgumentsCount = 2,
|
||||||
|
valueArgumentsCount = 1
|
||||||
|
).apply {
|
||||||
putTypeArgument(0, unsignedType)
|
putTypeArgument(0, unsignedType)
|
||||||
putTypeArgument(1, toType)
|
putTypeArgument(1, toType)
|
||||||
putValueArgument(0, this@asSigned)
|
putValueArgument(0, this@asSigned)
|
||||||
@@ -169,6 +190,7 @@ internal abstract class UnsignedProgressionType(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
internal class UIntProgressionType(symbols: Symbols<CommonBackendContext>) :
|
internal class UIntProgressionType(symbols: Symbols<CommonBackendContext>) :
|
||||||
UnsignedProgressionType(
|
UnsignedProgressionType(
|
||||||
symbols,
|
symbols,
|
||||||
@@ -186,6 +208,7 @@ internal class UIntProgressionType(symbols: Symbols<CommonBackendContext>) :
|
|||||||
override fun DeclarationIrBuilder.zeroStepExpression() = irInt(0)
|
override fun DeclarationIrBuilder.zeroStepExpression() = irInt(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
internal class ULongProgressionType(symbols: Symbols<CommonBackendContext>) :
|
internal class ULongProgressionType(symbols: Symbols<CommonBackendContext>) :
|
||||||
UnsignedProgressionType(
|
UnsignedProgressionType(
|
||||||
symbols,
|
symbols,
|
||||||
|
|||||||
+12
-4
@@ -8,7 +8,6 @@ package org.jetbrains.kotlin.backend.common.lower.loops
|
|||||||
import org.jetbrains.kotlin.backend.common.lower.DeclarationIrBuilder
|
import org.jetbrains.kotlin.backend.common.lower.DeclarationIrBuilder
|
||||||
import org.jetbrains.kotlin.ir.builders.createTmpVariable
|
import org.jetbrains.kotlin.ir.builders.createTmpVariable
|
||||||
import org.jetbrains.kotlin.ir.builders.irGet
|
import org.jetbrains.kotlin.ir.builders.irGet
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrValueDeclaration
|
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrVariable
|
import org.jetbrains.kotlin.ir.declarations.IrVariable
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrConst
|
import org.jetbrains.kotlin.ir.expressions.IrConst
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrConstKind
|
import org.jetbrains.kotlin.ir.expressions.IrConstKind
|
||||||
@@ -16,7 +15,6 @@ import org.jetbrains.kotlin.ir.expressions.IrExpression
|
|||||||
import org.jetbrains.kotlin.ir.expressions.IrGetValue
|
import org.jetbrains.kotlin.ir.expressions.IrGetValue
|
||||||
import org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl
|
import org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl
|
||||||
import org.jetbrains.kotlin.ir.expressions.impl.IrConstImpl
|
import org.jetbrains.kotlin.ir.expressions.impl.IrConstImpl
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrVariableSymbol
|
|
||||||
import org.jetbrains.kotlin.ir.types.IrType
|
import org.jetbrains.kotlin.ir.types.IrType
|
||||||
import org.jetbrains.kotlin.ir.types.getClass
|
import org.jetbrains.kotlin.ir.types.getClass
|
||||||
import org.jetbrains.kotlin.ir.types.isNothing
|
import org.jetbrains.kotlin.ir.types.isNothing
|
||||||
@@ -36,7 +34,12 @@ internal fun IrExpression.negate(): IrExpression {
|
|||||||
it.name == OperatorNameConventions.UNARY_MINUS &&
|
it.name == OperatorNameConventions.UNARY_MINUS &&
|
||||||
it.valueParameters.isEmpty()
|
it.valueParameters.isEmpty()
|
||||||
}
|
}
|
||||||
IrCallImpl(startOffset, endOffset, type, unaryMinusFun.symbol).apply {
|
IrCallImpl(
|
||||||
|
startOffset, endOffset, type,
|
||||||
|
unaryMinusFun.symbol,
|
||||||
|
valueArgumentsCount = 0,
|
||||||
|
typeArgumentsCount = 0
|
||||||
|
).apply {
|
||||||
dispatchReceiver = this@negate
|
dispatchReceiver = this@negate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -54,7 +57,12 @@ internal fun IrExpression.decrement(): IrExpression {
|
|||||||
it.name == OperatorNameConventions.DEC &&
|
it.name == OperatorNameConventions.DEC &&
|
||||||
it.valueParameters.isEmpty()
|
it.valueParameters.isEmpty()
|
||||||
}
|
}
|
||||||
IrCallImpl(startOffset, endOffset, type, decFun.symbol).apply {
|
IrCallImpl(
|
||||||
|
startOffset, endOffset, type,
|
||||||
|
decFun.symbol,
|
||||||
|
valueArgumentsCount = 0,
|
||||||
|
typeArgumentsCount = 0
|
||||||
|
).apply {
|
||||||
dispatchReceiver = this@decrement
|
dispatchReceiver = this@decrement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.backend.common.lower.matchers
|
package org.jetbrains.kotlin.backend.common.lower.matchers
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrFunction
|
import org.jetbrains.kotlin.ir.declarations.IrFunction
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrValueParameter
|
import org.jetbrains.kotlin.ir.declarations.IrValueParameter
|
||||||
import org.jetbrains.kotlin.ir.types.IrType
|
import org.jetbrains.kotlin.ir.types.IrType
|
||||||
@@ -51,6 +52,7 @@ internal class ParameterCountMatcher(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
internal class FqNameMatcher(
|
internal class FqNameMatcher(
|
||||||
val restriction: (FqName) -> Boolean
|
val restriction: (FqName) -> Boolean
|
||||||
) : IrFunctionMatcher {
|
) : IrFunctionMatcher {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.backend.common.ir.copyTypeParametersFrom
|
|||||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||||
import org.jetbrains.kotlin.descriptors.Visibility
|
import org.jetbrains.kotlin.descriptors.Visibility
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
||||||
import org.jetbrains.kotlin.ir.backend.js.JsMapping
|
import org.jetbrains.kotlin.ir.backend.js.JsMapping
|
||||||
import org.jetbrains.kotlin.ir.backend.js.ir.JsIrBuilder
|
import org.jetbrains.kotlin.ir.backend.js.ir.JsIrBuilder
|
||||||
@@ -94,6 +95,7 @@ class JsDeclarationFactory(mapping: JsMapping) : DeclarationFactory {
|
|||||||
return originalInnerClassPrimaryConstructorByClass[innerClass]
|
return originalInnerClassPrimaryConstructorByClass[innerClass]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
private fun createInnerClassConstructorWithOuterThisParameter(oldConstructor: IrConstructor): IrConstructor {
|
private fun createInnerClassConstructorWithOuterThisParameter(oldConstructor: IrConstructor): IrConstructor {
|
||||||
val irClass = oldConstructor.parent as IrClass
|
val irClass = oldConstructor.parent as IrClass
|
||||||
val outerThisType = (irClass.parent as IrClass).defaultType
|
val outerThisType = (irClass.parent as IrClass).defaultType
|
||||||
|
|||||||
@@ -14,10 +14,7 @@ import org.jetbrains.kotlin.config.CompilerConfiguration
|
|||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
import org.jetbrains.kotlin.descriptors.impl.EmptyPackageFragmentDescriptor
|
import org.jetbrains.kotlin.descriptors.impl.EmptyPackageFragmentDescriptor
|
||||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||||
import org.jetbrains.kotlin.ir.IrElement
|
import org.jetbrains.kotlin.ir.*
|
||||||
import org.jetbrains.kotlin.ir.SourceManager
|
|
||||||
import org.jetbrains.kotlin.ir.SourceRangeInfo
|
|
||||||
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
|
||||||
import org.jetbrains.kotlin.ir.backend.js.ir.JsIrBuilder
|
import org.jetbrains.kotlin.ir.backend.js.ir.JsIrBuilder
|
||||||
import org.jetbrains.kotlin.ir.backend.js.utils.OperatorNames
|
import org.jetbrains.kotlin.ir.backend.js.utils.OperatorNames
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
@@ -60,6 +57,8 @@ class JsIrBackendContext(
|
|||||||
|
|
||||||
val externalPackageFragment = mutableMapOf<IrFileSymbol, IrFile>()
|
val externalPackageFragment = mutableMapOf<IrFileSymbol, IrFile>()
|
||||||
val externalDeclarations = hashSetOf<IrDeclaration>()
|
val externalDeclarations = hashSetOf<IrDeclaration>()
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
val bodilessBuiltInsPackageFragment: IrPackageFragment = run {
|
val bodilessBuiltInsPackageFragment: IrPackageFragment = run {
|
||||||
|
|
||||||
class DescriptorlessExternalPackageFragmentSymbol : IrExternalPackageFragmentSymbol {
|
class DescriptorlessExternalPackageFragmentSymbol : IrExternalPackageFragmentSymbol {
|
||||||
|
|||||||
+9
-4
@@ -45,10 +45,15 @@ class JsSharedVariablesManager(val builtIns: IrBuiltIns, val implicitDeclaration
|
|||||||
val constructorSymbol = closureBoxConstructorDeclaration.symbol
|
val constructorSymbol = closureBoxConstructorDeclaration.symbol
|
||||||
|
|
||||||
val irCall =
|
val irCall =
|
||||||
IrConstructorCallImpl.fromSymbolDescriptor(initializer.startOffset, initializer.endOffset, closureBoxType, constructorSymbol)
|
IrConstructorCallImpl(
|
||||||
.apply {
|
initializer.startOffset, initializer.endOffset,
|
||||||
putValueArgument(0, initializer)
|
closureBoxType, constructorSymbol,
|
||||||
}
|
valueArgumentsCount = 1,
|
||||||
|
typeArgumentsCount = 0,
|
||||||
|
constructorTypeArgumentsCount = 0
|
||||||
|
).apply {
|
||||||
|
putValueArgument(0, initializer)
|
||||||
|
}
|
||||||
|
|
||||||
val descriptor = WrappedVariableDescriptor()
|
val descriptor = WrappedVariableDescriptor()
|
||||||
return IrVariableImpl(
|
return IrVariableImpl(
|
||||||
|
|||||||
@@ -26,20 +26,23 @@ object JsIrBuilder {
|
|||||||
object SYNTHESIZED_STATEMENT : IrStatementOriginImpl("SYNTHESIZED_STATEMENT")
|
object SYNTHESIZED_STATEMENT : IrStatementOriginImpl("SYNTHESIZED_STATEMENT")
|
||||||
object SYNTHESIZED_DECLARATION : IrDeclarationOriginImpl("SYNTHESIZED_DECLARATION")
|
object SYNTHESIZED_DECLARATION : IrDeclarationOriginImpl("SYNTHESIZED_DECLARATION")
|
||||||
|
|
||||||
fun buildCall(target: IrFunctionSymbol, type: IrType? = null, typeArguments: List<IrType>? = null): IrCall =
|
fun buildCall(target: IrFunctionSymbol, type: IrType? = null, typeArguments: List<IrType>? = null): IrCall {
|
||||||
IrCallImpl(
|
val owner = target.owner
|
||||||
|
return IrCallImpl(
|
||||||
UNDEFINED_OFFSET,
|
UNDEFINED_OFFSET,
|
||||||
UNDEFINED_OFFSET,
|
UNDEFINED_OFFSET,
|
||||||
type ?: target.owner.returnType,
|
type ?: owner.returnType,
|
||||||
target,
|
target,
|
||||||
target.owner.typeParameters.size,
|
typeArgumentsCount = owner.typeParameters.size,
|
||||||
SYNTHESIZED_STATEMENT
|
valueArgumentsCount = owner.valueParameters.size,
|
||||||
|
origin = SYNTHESIZED_STATEMENT
|
||||||
).apply {
|
).apply {
|
||||||
typeArguments?.let {
|
typeArguments?.let {
|
||||||
assert(typeArguments.size == typeArgumentsCount)
|
assert(typeArguments.size == typeArgumentsCount)
|
||||||
it.withIndex().forEach { (i, t) -> putTypeArgument(i, t) }
|
it.withIndex().forEach { (i, t) -> putTypeArgument(i, t) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun buildReturn(targetSymbol: IrFunctionSymbol, value: IrExpression, type: IrType) =
|
fun buildReturn(targetSymbol: IrFunctionSymbol, value: IrExpression, type: IrType) =
|
||||||
IrReturnImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, type, targetSymbol, value)
|
IrReturnImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, type, targetSymbol, value)
|
||||||
@@ -191,9 +194,6 @@ object JsIrBuilder {
|
|||||||
fun buildComposite(type: IrType, statements: List<IrStatement> = emptyList()) =
|
fun buildComposite(type: IrType, statements: List<IrStatement> = emptyList()) =
|
||||||
IrCompositeImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, type, SYNTHESIZED_STATEMENT, statements)
|
IrCompositeImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, type, SYNTHESIZED_STATEMENT, statements)
|
||||||
|
|
||||||
fun buildFunctionReference(type: IrType, symbol: IrFunctionSymbol, reflectionTarget: IrFunctionSymbol? = symbol) =
|
|
||||||
IrFunctionReferenceImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, type, symbol, 0, reflectionTarget, null)
|
|
||||||
|
|
||||||
fun buildFunctionExpression(type: IrType, function: IrSimpleFunction) =
|
fun buildFunctionExpression(type: IrType, function: IrSimpleFunction) =
|
||||||
IrFunctionExpressionImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, type, function, SYNTHESIZED_STATEMENT)
|
IrFunctionExpressionImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, type, function, SYNTHESIZED_STATEMENT)
|
||||||
|
|
||||||
|
|||||||
+2
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.backend.common.ir.isMethodOfAny
|
|||||||
import org.jetbrains.kotlin.backend.common.ir.isSuspend
|
import org.jetbrains.kotlin.backend.common.ir.isSuspend
|
||||||
import org.jetbrains.kotlin.backend.common.lower.*
|
import org.jetbrains.kotlin.backend.common.lower.*
|
||||||
import org.jetbrains.kotlin.descriptors.Modality
|
import org.jetbrains.kotlin.descriptors.Modality
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
||||||
import org.jetbrains.kotlin.ir.backend.js.JsLoweredDeclarationOrigin
|
import org.jetbrains.kotlin.ir.backend.js.JsLoweredDeclarationOrigin
|
||||||
import org.jetbrains.kotlin.ir.backend.js.ir.JsIrBuilder
|
import org.jetbrains.kotlin.ir.backend.js.ir.JsIrBuilder
|
||||||
@@ -48,6 +49,7 @@ import org.jetbrains.kotlin.ir.util.*
|
|||||||
// fun foo(t: Any?) = foo(t as Int) // Constructed bridge
|
// fun foo(t: Any?) = foo(t as Int) // Constructed bridge
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
class BridgesConstruction(val context: CommonBackendContext) : DeclarationTransformer {
|
class BridgesConstruction(val context: CommonBackendContext) : DeclarationTransformer {
|
||||||
|
|
||||||
private val specialBridgeMethods = SpecialBridgeMethods(context)
|
private val specialBridgeMethods = SpecialBridgeMethods(context)
|
||||||
|
|||||||
+6
-1
@@ -131,6 +131,11 @@ class CreateScriptFunctionsPhase(val context: CommonBackendContext) : FileLoweri
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun createCall(function: IrFunction): IrCall {
|
private fun createCall(function: IrFunction): IrCall {
|
||||||
return IrCallImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, function.returnType, function.symbol)
|
return IrCallImpl(
|
||||||
|
UNDEFINED_OFFSET, UNDEFINED_OFFSET, function.returnType,
|
||||||
|
function.symbol,
|
||||||
|
valueArgumentsCount = function.valueParameters.size,
|
||||||
|
typeArgumentsCount = function.typeParameters.size
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-1
@@ -528,7 +528,12 @@ class EnumSyntheticFunctionsLowering(val context: JsIrBackendContext): Declarati
|
|||||||
private fun List<IrExpression>.toArrayLiteral(arrayType: IrType, elementType: IrType): IrExpression {
|
private fun List<IrExpression>.toArrayLiteral(arrayType: IrType, elementType: IrType): IrExpression {
|
||||||
val irVararg = IrVarargImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, arrayType, elementType, this)
|
val irVararg = IrVarargImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, arrayType, elementType, this)
|
||||||
|
|
||||||
return IrCallImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, arrayType, context.intrinsics.arrayLiteral).apply {
|
return IrCallImpl(
|
||||||
|
UNDEFINED_OFFSET, UNDEFINED_OFFSET, arrayType,
|
||||||
|
context.intrinsics.arrayLiteral,
|
||||||
|
typeArgumentsCount = 0,
|
||||||
|
valueArgumentsCount = 1
|
||||||
|
).apply {
|
||||||
putValueArgument(0, irVararg)
|
putValueArgument(0, irVararg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-2
@@ -80,6 +80,7 @@ class JsDefaultCallbackGenerator(val context: JsIrBackendContext): BodyLoweringP
|
|||||||
context.irBuiltIns.anyType,
|
context.irBuiltIns.anyType,
|
||||||
originalFunction.symbol,
|
originalFunction.symbol,
|
||||||
typeArgumentsCount = 0,
|
typeArgumentsCount = 0,
|
||||||
|
valueArgumentsCount = originalFunction.valueParameters.size,
|
||||||
reflectionTarget = originalFunction.symbol,
|
reflectionTarget = originalFunction.symbol,
|
||||||
origin = BIND_CALL
|
origin = BIND_CALL
|
||||||
)
|
)
|
||||||
@@ -91,8 +92,10 @@ class JsDefaultCallbackGenerator(val context: JsIrBackendContext): BodyLoweringP
|
|||||||
endOffset,
|
endOffset,
|
||||||
context.irBuiltIns.anyType,
|
context.irBuiltIns.anyType,
|
||||||
context.intrinsics.jsBind.symbol,
|
context.intrinsics.jsBind.symbol,
|
||||||
BIND_CALL,
|
valueArgumentsCount = 2,
|
||||||
superQualifierSymbol
|
typeArgumentsCount = 0,
|
||||||
|
origin = BIND_CALL,
|
||||||
|
superQualifierSymbol = superQualifierSymbol
|
||||||
)
|
)
|
||||||
}.apply {
|
}.apply {
|
||||||
putValueArgument(0, irCall.dispatchReceiver?.deepCopyWithSymbols())
|
putValueArgument(0, irCall.dispatchReceiver?.deepCopyWithSymbols())
|
||||||
|
|||||||
+2
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.ir.backend.js.lower
|
|||||||
import org.jetbrains.kotlin.backend.common.DeclarationTransformer
|
import org.jetbrains.kotlin.backend.common.DeclarationTransformer
|
||||||
import org.jetbrains.kotlin.backend.common.ir.addChild
|
import org.jetbrains.kotlin.backend.common.ir.addChild
|
||||||
import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor
|
import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.IrElement
|
import org.jetbrains.kotlin.ir.IrElement
|
||||||
import org.jetbrains.kotlin.ir.backend.js.JsIrBackendContext
|
import org.jetbrains.kotlin.ir.backend.js.JsIrBackendContext
|
||||||
import org.jetbrains.kotlin.ir.backend.js.utils.getJsModule
|
import org.jetbrains.kotlin.ir.backend.js.utils.getJsModule
|
||||||
@@ -49,6 +50,7 @@ private class DescriptorlessIrFileSymbol : IrFileSymbol {
|
|||||||
_owner = owner
|
_owner = owner
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
override val descriptor: PackageFragmentDescriptor
|
override val descriptor: PackageFragmentDescriptor
|
||||||
get() = error("Operation is unsupported")
|
get() = error("Operation is unsupported")
|
||||||
|
|
||||||
|
|||||||
+6
-1
@@ -71,7 +71,12 @@ class DelegateToSyntheticPrimaryConstructor(context: JsCommonBackendContext) : B
|
|||||||
override fun visitDeclaration(declaration: IrDeclaration) = declaration // optimize visiting
|
override fun visitDeclaration(declaration: IrDeclaration) = declaration // optimize visiting
|
||||||
|
|
||||||
override fun visitInstanceInitializerCall(expression: IrInstanceInitializerCall) = expression.run {
|
override fun visitInstanceInitializerCall(expression: IrInstanceInitializerCall) = expression.run {
|
||||||
IrDelegatingConstructorCallImpl(startOffset, endOffset, type, primary.symbol)
|
IrDelegatingConstructorCallImpl(
|
||||||
|
startOffset, endOffset, type,
|
||||||
|
primary.symbol,
|
||||||
|
valueArgumentsCount = primary.valueParameters.size,
|
||||||
|
typeArgumentsCount = primary.typeParameters.size
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-3
@@ -199,9 +199,11 @@ class PrivateMemberBodiesLowering(val context: JsIrBackendContext) : BodyLowerin
|
|||||||
val newExpression = IrCallImpl(
|
val newExpression = IrCallImpl(
|
||||||
expression.startOffset, expression.endOffset,
|
expression.startOffset, expression.endOffset,
|
||||||
expression.type,
|
expression.type,
|
||||||
staticTarget.symbol, expression.typeArgumentsCount,
|
staticTarget.symbol,
|
||||||
expression.origin,
|
typeArgumentsCount = expression.typeArgumentsCount,
|
||||||
expression.superQualifierSymbol
|
valueArgumentsCount = expression.valueArgumentsCount + 1,
|
||||||
|
origin = expression.origin,
|
||||||
|
superQualifierSymbol = expression.superQualifierSymbol
|
||||||
)
|
)
|
||||||
|
|
||||||
newExpression.extensionReceiver = expression.extensionReceiver
|
newExpression.extensionReceiver = expression.extensionReceiver
|
||||||
|
|||||||
+2
@@ -8,6 +8,7 @@ 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.descriptors.ScriptDescriptor
|
import org.jetbrains.kotlin.descriptors.ScriptDescriptor
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.expressions.*
|
import org.jetbrains.kotlin.ir.expressions.*
|
||||||
import org.jetbrains.kotlin.ir.expressions.impl.IrConstImpl
|
import org.jetbrains.kotlin.ir.expressions.impl.IrConstImpl
|
||||||
@@ -36,6 +37,7 @@ class ScriptRemoveReceiverLowering(val context: CommonBackendContext) : FileLowe
|
|||||||
|
|
||||||
private fun IrExpression.nullConst() = IrConstImpl.constNull(startOffset, endOffset, type.makeNullable())
|
private fun IrExpression.nullConst() = IrConstImpl.constNull(startOffset, endOffset, type.makeNullable())
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
fun lower(script: IrScript): List<IrScript> {
|
fun lower(script: IrScript): List<IrScript> {
|
||||||
val transformer: IrElementTransformerVoid = object : IrElementTransformerVoid() {
|
val transformer: IrElementTransformerVoid = object : IrElementTransformerVoid() {
|
||||||
override fun visitCall(expression: IrCall): IrExpression {
|
override fun visitCall(expression: IrCall): IrExpression {
|
||||||
|
|||||||
+5
-1
@@ -272,7 +272,11 @@ private class CallsiteRedirectionTransformer(private val context: JsIrBackendCon
|
|||||||
private fun replaceSecondaryConstructorWithFactoryFunction(
|
private fun replaceSecondaryConstructorWithFactoryFunction(
|
||||||
call: IrFunctionAccessExpression,
|
call: IrFunctionAccessExpression,
|
||||||
newTarget: IrSimpleFunctionSymbol
|
newTarget: IrSimpleFunctionSymbol
|
||||||
) = IrCallImpl(call.startOffset, call.endOffset, call.type, newTarget, call.typeArgumentsCount).apply {
|
) = IrCallImpl(
|
||||||
|
call.startOffset, call.endOffset, call.type, newTarget,
|
||||||
|
typeArgumentsCount = call.typeArgumentsCount,
|
||||||
|
valueArgumentsCount = newTarget.owner.valueParameters.size
|
||||||
|
).apply {
|
||||||
|
|
||||||
copyTypeArgumentsFrom(call)
|
copyTypeArgumentsFrom(call)
|
||||||
|
|
||||||
|
|||||||
+10
-2
@@ -72,7 +72,11 @@ class ThrowableLowering(
|
|||||||
val (messageArg, causeArg) = expression.extractThrowableArguments()
|
val (messageArg, causeArg) = expression.extractThrowableArguments()
|
||||||
|
|
||||||
return expression.run {
|
return expression.run {
|
||||||
IrCallImpl(startOffset, endOffset, type, newThrowableFunction).also {
|
IrCallImpl(
|
||||||
|
startOffset, endOffset, type, newThrowableFunction,
|
||||||
|
valueArgumentsCount = 2,
|
||||||
|
typeArgumentsCount = 0
|
||||||
|
).also {
|
||||||
it.putValueArgument(0, messageArg)
|
it.putValueArgument(0, messageArg)
|
||||||
it.putValueArgument(1, causeArg)
|
it.putValueArgument(1, causeArg)
|
||||||
}
|
}
|
||||||
@@ -89,7 +93,11 @@ class ThrowableLowering(
|
|||||||
val thisReceiver = IrGetValueImpl(expression.startOffset, expression.endOffset, klass.thisReceiver!!.symbol)
|
val thisReceiver = IrGetValueImpl(expression.startOffset, expression.endOffset, klass.thisReceiver!!.symbol)
|
||||||
|
|
||||||
return expression.run {
|
return expression.run {
|
||||||
IrCallImpl(startOffset, endOffset, type, extendThrowableFunction).also {
|
IrCallImpl(
|
||||||
|
startOffset, endOffset, type, extendThrowableFunction,
|
||||||
|
valueArgumentsCount = 3,
|
||||||
|
typeArgumentsCount = 0
|
||||||
|
).also {
|
||||||
it.putValueArgument(0, thisReceiver)
|
it.putValueArgument(0, thisReceiver)
|
||||||
it.putValueArgument(1, messageArg)
|
it.putValueArgument(1, messageArg)
|
||||||
it.putValueArgument(2, causeArg)
|
it.putValueArgument(2, causeArg)
|
||||||
|
|||||||
+17
-4
@@ -6,6 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.ir.backend.js.lower
|
package org.jetbrains.kotlin.ir.backend.js.lower
|
||||||
|
|
||||||
import org.jetbrains.kotlin.backend.common.BodyLoweringPass
|
import org.jetbrains.kotlin.backend.common.BodyLoweringPass
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
||||||
import org.jetbrains.kotlin.ir.backend.js.JsIrBackendContext
|
import org.jetbrains.kotlin.ir.backend.js.JsIrBackendContext
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
|
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
|
||||||
@@ -30,6 +31,7 @@ private class VarargTransformer(
|
|||||||
val context: JsIrBackendContext
|
val context: JsIrBackendContext
|
||||||
) : IrElementTransformerVoid() {
|
) : IrElementTransformerVoid() {
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
private fun List<IrExpression>.toArrayLiteral(type: IrType, varargElementType: IrType): IrExpression {
|
private fun List<IrExpression>.toArrayLiteral(type: IrType, varargElementType: IrType): IrExpression {
|
||||||
|
|
||||||
// TODO: Use symbols when builtins symbol table is fixes
|
// TODO: Use symbols when builtins symbol table is fixes
|
||||||
@@ -47,8 +49,15 @@ private class VarargTransformer(
|
|||||||
|
|
||||||
val irVararg = IrVarargImpl(startOffset, endOffset, type, varargElementType, this)
|
val irVararg = IrVarargImpl(startOffset, endOffset, type, varargElementType, this)
|
||||||
|
|
||||||
return IrCallImpl(startOffset, endOffset, type, intrinsic).apply {
|
return IrCallImpl(
|
||||||
if (intrinsic.owner.typeParameters.isNotEmpty()) putTypeArgument(0, varargElementType)
|
startOffset, endOffset,
|
||||||
|
type, intrinsic,
|
||||||
|
typeArgumentsCount = if (intrinsic.owner.typeParameters.isNotEmpty()) 1 else 0,
|
||||||
|
valueArgumentsCount = 1
|
||||||
|
).apply {
|
||||||
|
if (typeArgumentsCount == 1) {
|
||||||
|
putTypeArgument(0, varargElementType)
|
||||||
|
}
|
||||||
putValueArgument(0, irVararg)
|
putValueArgument(0, irVararg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -149,7 +158,9 @@ private class VarargTransformer(
|
|||||||
expression.startOffset,
|
expression.startOffset,
|
||||||
expression.endOffset,
|
expression.endOffset,
|
||||||
arrayInfo.primitiveArrayType,
|
arrayInfo.primitiveArrayType,
|
||||||
copyFunction
|
copyFunction,
|
||||||
|
typeArgumentsCount = 1,
|
||||||
|
valueArgumentsCount = 1
|
||||||
).apply {
|
).apply {
|
||||||
putTypeArgument(0, arrayInfo.primitiveArrayType)
|
putTypeArgument(0, arrayInfo.primitiveArrayType)
|
||||||
putValueArgument(0, segment)
|
putValueArgument(0, segment)
|
||||||
@@ -175,7 +186,9 @@ private class VarargTransformer(
|
|||||||
expression.startOffset,
|
expression.startOffset,
|
||||||
expression.endOffset,
|
expression.endOffset,
|
||||||
arrayInfo.primitiveArrayType,
|
arrayInfo.primitiveArrayType,
|
||||||
concatFun
|
concatFun,
|
||||||
|
typeArgumentsCount = 0,
|
||||||
|
valueArgumentsCount = 1
|
||||||
).apply {
|
).apply {
|
||||||
putValueArgument(0, arrayLiteral)
|
putValueArgument(0, arrayLiteral)
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -51,7 +51,9 @@ class EqualityAndComparisonCallsTransformer(context: JsIrBackendContext) : Calls
|
|||||||
call.startOffset,
|
call.startOffset,
|
||||||
call.endOffset,
|
call.endOffset,
|
||||||
comparator.owner.returnType,
|
comparator.owner.returnType,
|
||||||
comparator
|
comparator,
|
||||||
|
typeArgumentsCount = 0,
|
||||||
|
valueArgumentsCount = 2
|
||||||
).apply {
|
).apply {
|
||||||
putValueArgument(0, irCall(call, intrinsics.longCompareToLong, argumentsAsReceivers = true))
|
putValueArgument(0, irCall(call, intrinsics.longCompareToLong, argumentsAsReceivers = true))
|
||||||
putValueArgument(1, JsIrBuilder.buildInt(irBuiltIns.intType, 0))
|
putValueArgument(1, JsIrBuilder.buildInt(irBuiltIns.intType, 0))
|
||||||
|
|||||||
+9
-3
@@ -208,7 +208,9 @@ class NumberOperatorCallsTransformer(context: JsIrBackendContext) : CallsTransfo
|
|||||||
call.startOffset,
|
call.startOffset,
|
||||||
call.endOffset,
|
call.endOffset,
|
||||||
intrinsics.longToDouble.owner.returnType,
|
intrinsics.longToDouble.owner.returnType,
|
||||||
intrinsics.longToDouble
|
intrinsics.longToDouble,
|
||||||
|
typeArgumentsCount = 0,
|
||||||
|
valueArgumentsCount = 0
|
||||||
).apply {
|
).apply {
|
||||||
dispatchReceiver = arg
|
dispatchReceiver = arg
|
||||||
})
|
})
|
||||||
@@ -219,7 +221,9 @@ class NumberOperatorCallsTransformer(context: JsIrBackendContext) : CallsTransfo
|
|||||||
call.startOffset,
|
call.startOffset,
|
||||||
call.endOffset,
|
call.endOffset,
|
||||||
intrinsics.longToFloat.owner.returnType,
|
intrinsics.longToFloat.owner.returnType,
|
||||||
intrinsics.longToFloat
|
intrinsics.longToFloat,
|
||||||
|
typeArgumentsCount = 0,
|
||||||
|
valueArgumentsCount = 0
|
||||||
).apply {
|
).apply {
|
||||||
dispatchReceiver = arg
|
dispatchReceiver = arg
|
||||||
})
|
})
|
||||||
@@ -230,7 +234,9 @@ class NumberOperatorCallsTransformer(context: JsIrBackendContext) : CallsTransfo
|
|||||||
call.startOffset,
|
call.startOffset,
|
||||||
call.endOffset,
|
call.endOffset,
|
||||||
intrinsics.jsNumberToLong.owner.returnType,
|
intrinsics.jsNumberToLong.owner.returnType,
|
||||||
intrinsics.jsNumberToLong
|
intrinsics.jsNumberToLong,
|
||||||
|
typeArgumentsCount = 0,
|
||||||
|
valueArgumentsCount = 1
|
||||||
).apply {
|
).apply {
|
||||||
putValueArgument(0, call.dispatchReceiver)
|
putValueArgument(0, call.dispatchReceiver)
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -38,7 +38,9 @@ class PrimitiveContainerMemberCallTransformer(private val context: JsIrBackendCo
|
|||||||
call.startOffset,
|
call.startOffset,
|
||||||
call.endOffset,
|
call.endOffset,
|
||||||
call.type,
|
call.type,
|
||||||
context.intrinsics.primitiveToSizeConstructor[elementType]!!
|
context.intrinsics.primitiveToSizeConstructor[elementType]!!,
|
||||||
|
typeArgumentsCount = 0,
|
||||||
|
valueArgumentsCount = 1
|
||||||
).apply {
|
).apply {
|
||||||
putValueArgument(0, call.getValueArgument(0))
|
putValueArgument(0, call.getValueArgument(0))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
package org.jetbrains.kotlin.ir.backend.js.utils
|
package org.jetbrains.kotlin.ir.backend.js.utils
|
||||||
|
|
||||||
import org.jetbrains.kotlin.ir.IrElement
|
import org.jetbrains.kotlin.ir.IrElement
|
||||||
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.backend.js.JsIrBackendContext
|
import org.jetbrains.kotlin.ir.backend.js.JsIrBackendContext
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
@@ -37,7 +36,12 @@ fun IrDeclaration.hasStaticDispatch() = when (this) {
|
|||||||
fun List<IrExpression>.toJsArrayLiteral(context: JsIrBackendContext, arrayType: IrType, elementType: IrType): IrExpression {
|
fun List<IrExpression>.toJsArrayLiteral(context: JsIrBackendContext, arrayType: IrType, elementType: IrType): IrExpression {
|
||||||
val irVararg = IrVarargImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, arrayType, elementType, this)
|
val irVararg = IrVarargImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, arrayType, elementType, this)
|
||||||
|
|
||||||
return IrCallImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, arrayType, context.intrinsics.arrayLiteral).apply {
|
return IrCallImpl(
|
||||||
|
UNDEFINED_OFFSET, UNDEFINED_OFFSET, arrayType,
|
||||||
|
context.intrinsics.arrayLiteral,
|
||||||
|
valueArgumentsCount = 1,
|
||||||
|
typeArgumentsCount = 0
|
||||||
|
).apply {
|
||||||
putValueArgument(0, irVararg)
|
putValueArgument(0, irVararg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -276,7 +276,7 @@ private class AddContinuationLowering(private val context: JvmBackendContext) :
|
|||||||
// TODO: fix the generic signature -- type parameters of FunctionN should be substituted
|
// TODO: fix the generic signature -- type parameters of FunctionN should be substituted
|
||||||
private fun IrClass.addInvokeCallingCreate(
|
private fun IrClass.addInvokeCallingCreate(
|
||||||
create: IrFunction,
|
create: IrFunction,
|
||||||
invokeSuspend: IrFunction,
|
invokeSuspend: IrSimpleFunction,
|
||||||
invokeToOverride: IrSimpleFunctionSymbol
|
invokeToOverride: IrSimpleFunctionSymbol
|
||||||
) = addFunctionOverride(invokeToOverride.owner) { function ->
|
) = addFunctionOverride(invokeToOverride.owner) { function ->
|
||||||
val newlyCreatedObject = irCall(create).also { createCall ->
|
val newlyCreatedObject = irCall(create).also { createCall ->
|
||||||
@@ -292,7 +292,7 @@ private class AddContinuationLowering(private val context: JvmBackendContext) :
|
|||||||
// versions; for other lambdas, there's no point in generating a non-overriding `create` separately.
|
// versions; for other lambdas, there's no point in generating a non-overriding `create` separately.
|
||||||
private fun IrClass.addInvokeCallingConstructor(
|
private fun IrClass.addInvokeCallingConstructor(
|
||||||
constructor: IrFunction,
|
constructor: IrFunction,
|
||||||
invokeSuspend: IrFunction,
|
invokeSuspend: IrSimpleFunction,
|
||||||
invokeToOverride: IrSimpleFunctionSymbol,
|
invokeToOverride: IrSimpleFunctionSymbol,
|
||||||
fieldsForBound: List<IrField>,
|
fieldsForBound: List<IrField>,
|
||||||
fieldsForUnbound: List<IrField>
|
fieldsForUnbound: List<IrField>
|
||||||
@@ -334,7 +334,7 @@ private class AddContinuationLowering(private val context: JvmBackendContext) :
|
|||||||
return irGet(result)
|
return irGet(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun IrBlockBodyBuilder.callInvokeSuspend(invokeSuspend: IrFunction, lambda: IrExpression): IrExpression {
|
private fun IrBlockBodyBuilder.callInvokeSuspend(invokeSuspend: IrSimpleFunction, lambda: IrExpression): IrExpression {
|
||||||
// SingletonReferencesLowering has finished a while ago, so `irUnit()` won't work anymore.
|
// SingletonReferencesLowering has finished a while ago, so `irUnit()` won't work anymore.
|
||||||
val unitClass = context.irBuiltIns.unitClass
|
val unitClass = context.irBuiltIns.unitClass
|
||||||
val unitField = this@AddContinuationLowering.context.declarationFactory.getFieldForObjectInstance(unitClass.owner)
|
val unitField = this@AddContinuationLowering.context.declarationFactory.getFieldForObjectInstance(unitClass.owner)
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import org.jetbrains.kotlin.backend.js.JsDeclarationFactory
|
|||||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||||
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.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.IrElement
|
import org.jetbrains.kotlin.ir.IrElement
|
||||||
import org.jetbrains.kotlin.ir.backend.js.JsCommonBackendContext
|
import org.jetbrains.kotlin.ir.backend.js.JsCommonBackendContext
|
||||||
import org.jetbrains.kotlin.ir.backend.js.JsMapping
|
import org.jetbrains.kotlin.ir.backend.js.JsMapping
|
||||||
@@ -80,6 +81,7 @@ class WasmBackendContext(
|
|||||||
}
|
}
|
||||||
|
|
||||||
class DescriptorlessExternalPackageFragmentSymbol : IrExternalPackageFragmentSymbol {
|
class DescriptorlessExternalPackageFragmentSymbol : IrExternalPackageFragmentSymbol {
|
||||||
|
@DescriptorBasedIr
|
||||||
override val descriptor: PackageFragmentDescriptor
|
override val descriptor: PackageFragmentDescriptor
|
||||||
get() = error("Operation is unsupported")
|
get() = error("Operation is unsupported")
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.psi2ir.generators
|
|||||||
import org.jetbrains.kotlin.backend.common.CodegenUtil
|
import org.jetbrains.kotlin.backend.common.CodegenUtil
|
||||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.IrClassImpl
|
import org.jetbrains.kotlin.ir.declarations.impl.IrClassImpl
|
||||||
import org.jetbrains.kotlin.ir.descriptors.IrImplementingDelegateDescriptorImpl
|
import org.jetbrains.kotlin.ir.descriptors.IrImplementingDelegateDescriptorImpl
|
||||||
@@ -55,6 +56,7 @@ import org.jetbrains.kotlin.types.TypeProjectionImpl
|
|||||||
import org.jetbrains.kotlin.types.TypeSubstitutor
|
import org.jetbrains.kotlin.types.TypeSubstitutor
|
||||||
import org.jetbrains.kotlin.utils.newHashMapWithExpectedSize
|
import org.jetbrains.kotlin.utils.newHashMapWithExpectedSize
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
class ClassGenerator(
|
class ClassGenerator(
|
||||||
declarationGenerator: DeclarationGenerator
|
declarationGenerator: DeclarationGenerator
|
||||||
) : DeclarationGeneratorExtension(declarationGenerator) {
|
) : DeclarationGeneratorExtension(declarationGenerator) {
|
||||||
|
|||||||
+1
-1
@@ -174,7 +174,7 @@ abstract class DeclarationGeneratorExtension(val declarationGenerator: Declarati
|
|||||||
|
|
||||||
inline fun <T : IrDeclaration> T.buildWithScope(builder: (T) -> Unit): T =
|
inline fun <T : IrDeclaration> T.buildWithScope(builder: (T) -> Unit): T =
|
||||||
also { irDeclaration ->
|
also { irDeclaration ->
|
||||||
context.symbolTable.withScope(irDeclaration.descriptor) {
|
context.symbolTable.withScope(irDeclaration) {
|
||||||
builder(irDeclaration)
|
builder(irDeclaration)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ class IrSyntheticDeclarationGenerator(context: GeneratorContext) : IrElementVisi
|
|||||||
|
|
||||||
contributedDescriptors.removeAll(declaredDescriptors)
|
contributedDescriptors.removeAll(declaredDescriptors)
|
||||||
|
|
||||||
symbolTable.withScope(irClass.descriptor) {
|
symbolTable.withScope(irClass) {
|
||||||
contributedDescriptors.forEach { it.accept(descriptorGenerator, irClass) }
|
contributedDescriptors.forEach { it.accept(descriptorGenerator, irClass) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -499,7 +499,7 @@ class OperatorExpressionGenerator(statementGenerator: StatementGenerator) : Stat
|
|||||||
?: throw AssertionError("No type for !! argument")
|
?: throw AssertionError("No type for !! argument")
|
||||||
val expressionType = argumentType.makeNotNullable()
|
val expressionType = argumentType.makeNotNullable()
|
||||||
|
|
||||||
val checkNotNull = context.irBuiltIns.checkNotNull
|
val checkNotNull = context.irBuiltIns.checkNotNullSymbol.descriptor
|
||||||
val checkNotNullSubstituted =
|
val checkNotNullSubstituted =
|
||||||
checkNotNull.substitute(
|
checkNotNull.substitute(
|
||||||
TypeSubstitutor.create(
|
TypeSubstitutor.create(
|
||||||
|
|||||||
+2
-2
@@ -78,7 +78,7 @@ class StandaloneDeclarationGenerator(private val context: GeneratorContext) {
|
|||||||
|
|
||||||
val irClass = IrClassImpl(startOffset, endOffset, origin, symbol, descriptor)
|
val irClass = IrClassImpl(startOffset, endOffset, origin, symbol, descriptor)
|
||||||
|
|
||||||
symbolTable.withScope(descriptor) {
|
symbolTable.withScope(irClass) {
|
||||||
irClass.metadata = MetadataSource.Class(descriptor)
|
irClass.metadata = MetadataSource.Class(descriptor)
|
||||||
|
|
||||||
generateGlobalTypeParametersDeclarations(irClass, descriptor.declaredTypeParameters)
|
generateGlobalTypeParametersDeclarations(irClass, descriptor.declaredTypeParameters)
|
||||||
@@ -162,7 +162,7 @@ class StandaloneDeclarationGenerator(private val context: GeneratorContext) {
|
|||||||
val irConstructor = IrConstructorImpl(startOffset, endOffset, origin, symbol, IrUninitializedType, descriptor)
|
val irConstructor = IrConstructorImpl(startOffset, endOffset, origin, symbol, IrUninitializedType, descriptor)
|
||||||
irConstructor.metadata = MetadataSource.Function(descriptor)
|
irConstructor.metadata = MetadataSource.Function(descriptor)
|
||||||
|
|
||||||
symbolTable.withScope(descriptor) {
|
symbolTable.withScope(irConstructor) {
|
||||||
val ctorTypeParameters = descriptor.typeParameters.filter { it.containingDeclaration === descriptor }
|
val ctorTypeParameters = descriptor.typeParameters.filter { it.containingDeclaration === descriptor }
|
||||||
generateScopedTypeParameterDeclarations(irConstructor, ctorTypeParameters)
|
generateScopedTypeParameterDeclarations(irConstructor, ctorTypeParameters)
|
||||||
generateValueParameterDeclarations(irConstructor, descriptor, defaultArgumentFactory)
|
generateValueParameterDeclarations(irConstructor, descriptor, defaultArgumentFactory)
|
||||||
|
|||||||
@@ -13,12 +13,4 @@ dependencies {
|
|||||||
sourceSets {
|
sourceSets {
|
||||||
"main" { projectDefault() }
|
"main" { projectDefault() }
|
||||||
"test" {}
|
"test" {}
|
||||||
}
|
|
||||||
|
|
||||||
tasks {
|
|
||||||
val compileKotlin by existing(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class) {
|
|
||||||
kotlinOptions {
|
|
||||||
freeCompilerArgs += "-Xopt-in=org.jetbrains.kotlin.ir.DescriptorBasedIr"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.ir.expressions.impl.*
|
|||||||
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.util.parentAsClass
|
import org.jetbrains.kotlin.ir.util.parentAsClass
|
||||||
|
import org.jetbrains.kotlin.ir.util.render
|
||||||
import org.jetbrains.kotlin.types.KotlinType
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.assertedCast
|
import org.jetbrains.kotlin.utils.addToStdlib.assertedCast
|
||||||
|
|
||||||
@@ -45,12 +46,6 @@ fun <T : IrElement> IrStatementsBuilder<T>.irTemporary(
|
|||||||
return temporary
|
return temporary
|
||||||
}
|
}
|
||||||
|
|
||||||
fun <T : IrElement> IrStatementsBuilder<T>.defineTemporary(value: IrExpression, nameHint: String? = null): VariableDescriptor {
|
|
||||||
val temporary = scope.createTemporaryVariable(value, nameHint)
|
|
||||||
+temporary
|
|
||||||
return temporary.descriptor
|
|
||||||
}
|
|
||||||
|
|
||||||
fun <T : IrElement> IrStatementsBuilder<T>.irTemporaryVarDeclaration(
|
fun <T : IrElement> IrStatementsBuilder<T>.irTemporaryVarDeclaration(
|
||||||
type: IrType,
|
type: IrType,
|
||||||
nameHint: String? = null,
|
nameHint: String? = null,
|
||||||
@@ -72,12 +67,6 @@ fun <T : IrElement> IrStatementsBuilder<T>.irTemporaryVar(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun <T : IrElement> IrStatementsBuilder<T>.defineTemporaryVar(value: IrExpression, nameHint: String? = null): VariableDescriptor {
|
|
||||||
val temporary = scope.createTemporaryVariable(value, nameHint, isMutable = true)
|
|
||||||
+temporary
|
|
||||||
return temporary.descriptor
|
|
||||||
}
|
|
||||||
|
|
||||||
fun IrBuilderWithScope.irExprBody(value: IrExpression) =
|
fun IrBuilderWithScope.irExprBody(value: IrExpression) =
|
||||||
IrExpressionBodyImpl(startOffset, endOffset, value)
|
IrExpressionBodyImpl(startOffset, endOffset, value)
|
||||||
|
|
||||||
@@ -89,7 +78,7 @@ fun IrBuilderWithScope.irReturn(value: IrExpression) =
|
|||||||
startOffset, endOffset,
|
startOffset, endOffset,
|
||||||
context.irBuiltIns.nothingType,
|
context.irBuiltIns.nothingType,
|
||||||
scope.scopeOwnerSymbol.assertedCast<IrReturnTargetSymbol> {
|
scope.scopeOwnerSymbol.assertedCast<IrReturnTargetSymbol> {
|
||||||
"Function scope expected: ${scope.scopeOwner}"
|
"Function scope expected: ${scope.scopeOwnerSymbol.owner.render()}"
|
||||||
},
|
},
|
||||||
value
|
value
|
||||||
)
|
)
|
||||||
@@ -240,11 +229,29 @@ fun IrBuilderWithScope.irCallConstructor(callee: IrConstructorSymbol, typeArgume
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun IrBuilderWithScope.irCall(callee: IrSimpleFunctionSymbol, type: IrType): IrCall =
|
fun IrBuilderWithScope.irCall(
|
||||||
IrCallImpl(startOffset, endOffset, type, callee)
|
callee: IrSimpleFunctionSymbol,
|
||||||
|
type: IrType,
|
||||||
|
valueArgumentsCount: Int = callee.owner.valueParameters.size,
|
||||||
|
typeArgumentsCount: Int = callee.owner.typeParameters.size
|
||||||
|
): IrCall =
|
||||||
|
IrCallImpl(
|
||||||
|
startOffset, endOffset, type, callee,
|
||||||
|
typeArgumentsCount = typeArgumentsCount,
|
||||||
|
valueArgumentsCount = valueArgumentsCount
|
||||||
|
)
|
||||||
|
|
||||||
fun IrBuilderWithScope.irCall(callee: IrConstructorSymbol, type: IrType): IrConstructorCall =
|
fun IrBuilderWithScope.irCall(
|
||||||
IrConstructorCallImpl.fromSymbolDescriptor(startOffset, endOffset, type, callee)
|
callee: IrConstructorSymbol,
|
||||||
|
type: IrType,
|
||||||
|
constructedClass: IrClass = callee.owner.parentAsClass
|
||||||
|
): IrConstructorCall =
|
||||||
|
IrConstructorCallImpl(
|
||||||
|
startOffset, endOffset, type, callee,
|
||||||
|
valueArgumentsCount = callee.owner.valueParameters.size,
|
||||||
|
typeArgumentsCount = callee.owner.typeParameters.size + constructedClass.typeParameters.size,
|
||||||
|
constructorTypeArgumentsCount = callee.owner.typeParameters.size
|
||||||
|
)
|
||||||
|
|
||||||
fun IrBuilderWithScope.irCall(callee: IrFunctionSymbol, type: IrType): IrFunctionAccessExpression =
|
fun IrBuilderWithScope.irCall(callee: IrFunctionSymbol, type: IrType): IrFunctionAccessExpression =
|
||||||
when (callee) {
|
when (callee) {
|
||||||
@@ -263,7 +270,12 @@ fun IrBuilderWithScope.irCall(callee: IrFunctionSymbol): IrFunctionAccessExpress
|
|||||||
irCall(callee, callee.owner.returnType)
|
irCall(callee, callee.owner.returnType)
|
||||||
|
|
||||||
fun IrBuilderWithScope.irCall(callee: IrFunctionSymbol, descriptor: FunctionDescriptor, type: IrType): IrCall =
|
fun IrBuilderWithScope.irCall(callee: IrFunctionSymbol, descriptor: FunctionDescriptor, type: IrType): IrCall =
|
||||||
IrCallImpl(startOffset, endOffset, type, callee as IrSimpleFunctionSymbol)
|
IrCallImpl(
|
||||||
|
startOffset, endOffset, type,
|
||||||
|
callee as IrSimpleFunctionSymbol,
|
||||||
|
valueArgumentsCount = callee.owner.valueParameters.size,
|
||||||
|
typeArgumentsCount = callee.owner.typeParameters.size
|
||||||
|
)
|
||||||
|
|
||||||
fun IrBuilderWithScope.irCall(callee: IrFunction): IrFunctionAccessExpression =
|
fun IrBuilderWithScope.irCall(callee: IrFunction): IrFunctionAccessExpression =
|
||||||
irCall(callee.symbol)
|
irCall(callee.symbol)
|
||||||
@@ -283,12 +295,12 @@ fun IrBuilderWithScope.irDelegatingConstructorCall(callee: IrConstructor): IrDel
|
|||||||
)
|
)
|
||||||
|
|
||||||
fun IrBuilderWithScope.irCallOp(
|
fun IrBuilderWithScope.irCallOp(
|
||||||
callee: IrFunctionSymbol,
|
callee: IrSimpleFunctionSymbol,
|
||||||
type: IrType,
|
type: IrType,
|
||||||
dispatchReceiver: IrExpression,
|
dispatchReceiver: IrExpression,
|
||||||
argument: IrExpression? = null
|
argument: IrExpression? = null
|
||||||
): IrMemberAccessExpression =
|
): IrMemberAccessExpression =
|
||||||
irCall(callee, type).apply {
|
irCall(callee, type, valueArgumentsCount = if (argument != null) 1 else 0, typeArgumentsCount = 0).apply {
|
||||||
this.dispatchReceiver = dispatchReceiver
|
this.dispatchReceiver = dispatchReceiver
|
||||||
if (argument != null)
|
if (argument != null)
|
||||||
putValueArgument(0, argument)
|
putValueArgument(0, argument)
|
||||||
|
|||||||
@@ -33,7 +33,12 @@ fun primitiveOp1(
|
|||||||
origin: IrStatementOrigin,
|
origin: IrStatementOrigin,
|
||||||
dispatchReceiver: IrExpression
|
dispatchReceiver: IrExpression
|
||||||
): IrExpression =
|
): IrExpression =
|
||||||
IrCallImpl(startOffset, endOffset, primitiveOpReturnType, primitiveOpSymbol, origin = origin).also {
|
IrCallImpl(
|
||||||
|
startOffset, endOffset, primitiveOpReturnType, primitiveOpSymbol,
|
||||||
|
typeArgumentsCount = 0,
|
||||||
|
valueArgumentsCount = 0,
|
||||||
|
origin = origin
|
||||||
|
).also {
|
||||||
it.dispatchReceiver = dispatchReceiver
|
it.dispatchReceiver = dispatchReceiver
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,7 +52,8 @@ fun primitiveOp2(
|
|||||||
IrCallImpl(
|
IrCallImpl(
|
||||||
startOffset, endOffset,
|
startOffset, endOffset,
|
||||||
primitiveOpReturnType,
|
primitiveOpReturnType,
|
||||||
primitiveOpSymbol, typeArgumentsCount = 0,
|
primitiveOpSymbol,
|
||||||
|
typeArgumentsCount = 0,
|
||||||
valueArgumentsCount = 2,
|
valueArgumentsCount = 2,
|
||||||
origin = origin
|
origin = origin
|
||||||
).apply {
|
).apply {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package org.jetbrains.kotlin.ir.builders
|
package org.jetbrains.kotlin.ir.builders
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
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.IrDeclarationOrigin
|
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||||
@@ -34,7 +35,9 @@ import org.jetbrains.kotlin.ir.types.toKotlinType
|
|||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.types.KotlinType
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
class Scope(val scopeOwnerSymbol: IrSymbol) {
|
class Scope(val scopeOwnerSymbol: IrSymbol) {
|
||||||
|
@DescriptorBasedIr
|
||||||
val scopeOwner: DeclarationDescriptor get() = scopeOwnerSymbol.descriptor
|
val scopeOwner: DeclarationDescriptor get() = scopeOwnerSymbol.descriptor
|
||||||
|
|
||||||
fun getLocalDeclarationParent(): IrDeclarationParent {
|
fun getLocalDeclarationParent(): IrDeclarationParent {
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2016 JetBrains s.r.o.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.ir.builders
|
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
|
||||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
|
||||||
import org.jetbrains.kotlin.descriptors.MemberDescriptor
|
|
||||||
|
|
||||||
inline fun <reified T> Scope.assertCastOwner() =
|
|
||||||
scopeOwner as? T ?: throw AssertionError("Unexpected scopeOwner: $scopeOwner")
|
|
||||||
|
|
||||||
fun Scope.functionOwner(): FunctionDescriptor =
|
|
||||||
assertCastOwner()
|
|
||||||
|
|
||||||
fun Scope.classOwner(): ClassDescriptor =
|
|
||||||
scopeOwner.let {
|
|
||||||
when (it) {
|
|
||||||
is ClassDescriptor -> it
|
|
||||||
is MemberDescriptor -> it.containingDeclaration as ClassDescriptor
|
|
||||||
else -> throw AssertionError("Unexpected scopeOwner: $scopeOwner")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -17,10 +17,12 @@
|
|||||||
package org.jetbrains.kotlin.ir.declarations
|
package org.jetbrains.kotlin.ir.declarations
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrBlockBody
|
import org.jetbrains.kotlin.ir.expressions.IrBlockBody
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrAnonymousInitializerSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrAnonymousInitializerSymbol
|
||||||
|
|
||||||
interface IrAnonymousInitializer : IrSymbolDeclaration<IrAnonymousInitializerSymbol> {
|
interface IrAnonymousInitializer : IrSymbolDeclaration<IrAnonymousInitializerSymbol> {
|
||||||
|
@DescriptorBasedIr
|
||||||
override val descriptor: ClassDescriptor // TODO special descriptor for anonymous initializer blocks
|
override val descriptor: ClassDescriptor // TODO special descriptor for anonymous initializer blocks
|
||||||
val isStatic: Boolean
|
val isStatic: Boolean
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.ir.declarations
|
package org.jetbrains.kotlin.ir.declarations
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
||||||
import org.jetbrains.kotlin.ir.types.IrType
|
import org.jetbrains.kotlin.ir.types.IrType
|
||||||
@@ -24,6 +25,7 @@ interface IrClass :
|
|||||||
IrSymbolDeclaration<IrClassSymbol>, IrDeclarationWithName, IrDeclarationWithVisibility,
|
IrSymbolDeclaration<IrClassSymbol>, IrDeclarationWithName, IrDeclarationWithVisibility,
|
||||||
IrDeclarationContainer, IrTypeParametersContainer, IrAttributeContainer {
|
IrDeclarationContainer, IrTypeParametersContainer, IrAttributeContainer {
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
override val descriptor: ClassDescriptor
|
override val descriptor: ClassDescriptor
|
||||||
|
|
||||||
override var visibility: Visibility
|
override var visibility: Visibility
|
||||||
|
|||||||
@@ -18,10 +18,12 @@ package org.jetbrains.kotlin.ir.declarations
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.ClassConstructorDescriptor
|
import org.jetbrains.kotlin.descriptors.ClassConstructorDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.Visibility
|
import org.jetbrains.kotlin.descriptors.Visibility
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol
|
||||||
|
|
||||||
|
|
||||||
interface IrConstructor : IrFunction, IrSymbolDeclaration<IrConstructorSymbol> {
|
interface IrConstructor : IrFunction, IrSymbolDeclaration<IrConstructorSymbol> {
|
||||||
|
@DescriptorBasedIr
|
||||||
override val descriptor: ClassConstructorDescriptor
|
override val descriptor: ClassConstructorDescriptor
|
||||||
|
|
||||||
override var visibility: Visibility
|
override var visibility: Visibility
|
||||||
|
|||||||
@@ -17,10 +17,12 @@
|
|||||||
package org.jetbrains.kotlin.ir.declarations
|
package org.jetbrains.kotlin.ir.declarations
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
|
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrEnumEntrySymbol
|
import org.jetbrains.kotlin.ir.symbols.IrEnumEntrySymbol
|
||||||
|
|
||||||
interface IrEnumEntry : IrSymbolDeclaration<IrEnumEntrySymbol>, IrDeclarationWithName {
|
interface IrEnumEntry : IrSymbolDeclaration<IrEnumEntrySymbol>, IrDeclarationWithName {
|
||||||
|
@DescriptorBasedIr
|
||||||
override val descriptor: ClassDescriptor
|
override val descriptor: ClassDescriptor
|
||||||
|
|
||||||
var correspondingClass: IrClass?
|
var correspondingClass: IrClass?
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.ir.declarations
|
package org.jetbrains.kotlin.ir.declarations
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
|
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrFieldSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrFieldSymbol
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrPropertySymbol
|
import org.jetbrains.kotlin.ir.symbols.IrPropertySymbol
|
||||||
@@ -15,6 +16,7 @@ interface IrField :
|
|||||||
IrSymbolDeclaration<IrFieldSymbol>, IrOverridableDeclaration<IrFieldSymbol>,
|
IrSymbolDeclaration<IrFieldSymbol>, IrOverridableDeclaration<IrFieldSymbol>,
|
||||||
IrDeclarationWithName, IrDeclarationWithVisibility, IrDeclarationParent {
|
IrDeclarationWithName, IrDeclarationWithVisibility, IrDeclarationParent {
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
override val descriptor: PropertyDescriptor
|
override val descriptor: PropertyDescriptor
|
||||||
|
|
||||||
val type: IrType
|
val type: IrType
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.ir.declarations
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrBody
|
import org.jetbrains.kotlin.ir.expressions.IrBody
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
|
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
|
||||||
@@ -26,6 +27,7 @@ import org.jetbrains.kotlin.ir.types.IrType
|
|||||||
interface IrFunction :
|
interface IrFunction :
|
||||||
IrDeclarationWithName, IrDeclarationWithVisibility, IrTypeParametersContainer, IrSymbolOwner, IrDeclarationParent, IrReturnTarget {
|
IrDeclarationWithName, IrDeclarationWithVisibility, IrTypeParametersContainer, IrSymbolOwner, IrDeclarationParent, IrReturnTarget {
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
override val descriptor: FunctionDescriptor
|
override val descriptor: FunctionDescriptor
|
||||||
override val symbol: IrFunctionSymbol
|
override val symbol: IrFunctionSymbol
|
||||||
|
|
||||||
@@ -44,7 +46,7 @@ interface IrFunction :
|
|||||||
override val metadata: MetadataSource?
|
override val metadata: MetadataSource?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
fun IrFunction.getIrValueParameter(parameter: ValueParameterDescriptor): IrValueParameter =
|
fun IrFunction.getIrValueParameter(parameter: ValueParameterDescriptor): IrValueParameter =
|
||||||
valueParameters.getOrElse(parameter.index) {
|
valueParameters.getOrElse(parameter.index) {
|
||||||
throw AssertionError("No IrValueParameter for $parameter")
|
throw AssertionError("No IrValueParameter for $parameter")
|
||||||
@@ -54,9 +56,7 @@ fun IrFunction.getIrValueParameter(parameter: ValueParameterDescriptor): IrValue
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun IrFunction.getDefault(parameter: ValueParameterDescriptor): IrExpressionBody? =
|
@DescriptorBasedIr
|
||||||
getIrValueParameter(parameter).defaultValue
|
|
||||||
|
|
||||||
fun IrFunction.putDefault(parameter: ValueParameterDescriptor, expressionBody: IrExpressionBody) {
|
fun IrFunction.putDefault(parameter: ValueParameterDescriptor, expressionBody: IrExpressionBody) {
|
||||||
getIrValueParameter(parameter).defaultValue = expressionBody
|
getIrValueParameter(parameter).defaultValue = expressionBody
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -17,6 +17,7 @@
|
|||||||
package org.jetbrains.kotlin.ir.declarations
|
package org.jetbrains.kotlin.ir.declarations
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.VariableDescriptorWithAccessors
|
import org.jetbrains.kotlin.descriptors.VariableDescriptorWithAccessors
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrLocalDelegatedPropertySymbol
|
import org.jetbrains.kotlin.ir.symbols.IrLocalDelegatedPropertySymbol
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||||
import org.jetbrains.kotlin.ir.types.IrType
|
import org.jetbrains.kotlin.ir.types.IrType
|
||||||
@@ -25,6 +26,7 @@ interface IrLocalDelegatedProperty :
|
|||||||
IrDeclarationWithName,
|
IrDeclarationWithName,
|
||||||
IrSymbolOwner {
|
IrSymbolOwner {
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
override val descriptor: VariableDescriptorWithAccessors
|
override val descriptor: VariableDescriptorWithAccessors
|
||||||
override val symbol: IrLocalDelegatedPropertySymbol
|
override val symbol: IrLocalDelegatedPropertySymbol
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.ir.declarations
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.Modality
|
import org.jetbrains.kotlin.descriptors.Modality
|
||||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrPropertySymbol
|
import org.jetbrains.kotlin.ir.symbols.IrPropertySymbol
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
|
||||||
|
|
||||||
@@ -27,6 +28,7 @@ interface IrProperty :
|
|||||||
IrOverridableMember,
|
IrOverridableMember,
|
||||||
IrSymbolOwner {
|
IrSymbolOwner {
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
override val descriptor: PropertyDescriptor
|
override val descriptor: PropertyDescriptor
|
||||||
override val symbol: IrPropertySymbol
|
override val symbol: IrPropertySymbol
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,12 @@
|
|||||||
package org.jetbrains.kotlin.ir.declarations
|
package org.jetbrains.kotlin.ir.declarations
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrReturnTargetSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrReturnTargetSymbol
|
||||||
|
|
||||||
interface IrReturnTarget : IrSymbolOwner {
|
interface IrReturnTarget : IrSymbolOwner {
|
||||||
|
@DescriptorBasedIr
|
||||||
val descriptor: FunctionDescriptor
|
val descriptor: FunctionDescriptor
|
||||||
|
|
||||||
override val symbol: IrReturnTargetSymbol
|
override val symbol: IrReturnTargetSymbol
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.ir.declarations
|
package org.jetbrains.kotlin.ir.declarations
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.TypeAliasDescriptor
|
import org.jetbrains.kotlin.descriptors.TypeAliasDescriptor
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrTypeAliasSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrTypeAliasSymbol
|
||||||
import org.jetbrains.kotlin.ir.types.IrType
|
import org.jetbrains.kotlin.ir.types.IrType
|
||||||
|
|
||||||
@@ -15,7 +16,9 @@ interface IrTypeAlias :
|
|||||||
IrDeclarationWithVisibility,
|
IrDeclarationWithVisibility,
|
||||||
IrTypeParametersContainer {
|
IrTypeParametersContainer {
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
override val descriptor: TypeAliasDescriptor
|
override val descriptor: TypeAliasDescriptor
|
||||||
|
|
||||||
val isActual: Boolean
|
val isActual: Boolean
|
||||||
val expandedType: IrType
|
val expandedType: IrType
|
||||||
}
|
}
|
||||||
@@ -17,12 +17,14 @@
|
|||||||
package org.jetbrains.kotlin.ir.declarations
|
package org.jetbrains.kotlin.ir.declarations
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
|
||||||
import org.jetbrains.kotlin.ir.types.IrType
|
import org.jetbrains.kotlin.ir.types.IrType
|
||||||
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
|
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
|
||||||
import org.jetbrains.kotlin.types.Variance
|
import org.jetbrains.kotlin.types.Variance
|
||||||
|
|
||||||
interface IrTypeParameter : IrSymbolDeclaration<IrTypeParameterSymbol>, IrDeclarationWithName {
|
interface IrTypeParameter : IrSymbolDeclaration<IrTypeParameterSymbol>, IrDeclarationWithName {
|
||||||
|
@DescriptorBasedIr
|
||||||
override val descriptor: TypeParameterDescriptor
|
override val descriptor: TypeParameterDescriptor
|
||||||
|
|
||||||
val variance: Variance
|
val variance: Variance
|
||||||
|
|||||||
@@ -6,12 +6,14 @@
|
|||||||
package org.jetbrains.kotlin.ir.declarations
|
package org.jetbrains.kotlin.ir.declarations
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.ValueDescriptor
|
import org.jetbrains.kotlin.descriptors.ValueDescriptor
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrValueSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrValueSymbol
|
||||||
import org.jetbrains.kotlin.ir.types.IrType
|
import org.jetbrains.kotlin.ir.types.IrType
|
||||||
|
|
||||||
interface IrValueDeclaration : IrDeclarationWithName, IrSymbolOwner {
|
interface IrValueDeclaration : IrDeclarationWithName, IrSymbolOwner {
|
||||||
|
@DescriptorBasedIr
|
||||||
override val descriptor: ValueDescriptor
|
override val descriptor: ValueDescriptor
|
||||||
override val symbol: IrValueSymbol
|
|
||||||
|
|
||||||
|
override val symbol: IrValueSymbol
|
||||||
val type: IrType
|
val type: IrType
|
||||||
}
|
}
|
||||||
@@ -17,12 +17,14 @@
|
|||||||
package org.jetbrains.kotlin.ir.declarations
|
package org.jetbrains.kotlin.ir.declarations
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.ParameterDescriptor
|
import org.jetbrains.kotlin.descriptors.ParameterDescriptor
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
|
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrValueParameterSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrValueParameterSymbol
|
||||||
import org.jetbrains.kotlin.ir.types.IrType
|
import org.jetbrains.kotlin.ir.types.IrType
|
||||||
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
|
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
|
||||||
|
|
||||||
interface IrValueParameter : IrValueDeclaration, IrSymbolDeclaration<IrValueParameterSymbol> {
|
interface IrValueParameter : IrValueDeclaration, IrSymbolDeclaration<IrValueParameterSymbol> {
|
||||||
|
@DescriptorBasedIr
|
||||||
override val descriptor: ParameterDescriptor
|
override val descriptor: ParameterDescriptor
|
||||||
|
|
||||||
val index: Int
|
val index: Int
|
||||||
|
|||||||
@@ -17,10 +17,12 @@
|
|||||||
package org.jetbrains.kotlin.ir.declarations
|
package org.jetbrains.kotlin.ir.declarations
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.VariableDescriptor
|
import org.jetbrains.kotlin.descriptors.VariableDescriptor
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrVariableSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrVariableSymbol
|
||||||
|
|
||||||
interface IrVariable : IrValueDeclaration, IrSymbolDeclaration<IrVariableSymbol> {
|
interface IrVariable : IrValueDeclaration, IrSymbolDeclaration<IrVariableSymbol> {
|
||||||
|
@DescriptorBasedIr
|
||||||
override val descriptor: VariableDescriptor
|
override val descriptor: VariableDescriptor
|
||||||
|
|
||||||
val isVar: Boolean
|
val isVar: Boolean
|
||||||
|
|||||||
+2
@@ -17,6 +17,7 @@
|
|||||||
package org.jetbrains.kotlin.ir.declarations.impl
|
package org.jetbrains.kotlin.ir.declarations.impl
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrAnonymousInitializer
|
import org.jetbrains.kotlin.ir.declarations.IrAnonymousInitializer
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.carriers.AnonymousInitializerCarrier
|
import org.jetbrains.kotlin.ir.declarations.impl.carriers.AnonymousInitializerCarrier
|
||||||
@@ -39,6 +40,7 @@ class IrAnonymousInitializerImpl(
|
|||||||
symbol.bind(this)
|
symbol.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
override val descriptor: ClassDescriptor get() = symbol.descriptor
|
override val descriptor: ClassDescriptor get() = symbol.descriptor
|
||||||
|
|
||||||
override var bodyField: IrBlockBody? = null
|
override var bodyField: IrBlockBody? = null
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package org.jetbrains.kotlin.ir.declarations.impl
|
package org.jetbrains.kotlin.ir.declarations.impl
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.carriers.ClassCarrier
|
import org.jetbrains.kotlin.ir.declarations.impl.carriers.ClassCarrier
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
||||||
@@ -76,6 +77,7 @@ class IrClassImpl(
|
|||||||
symbol.bind(this)
|
symbol.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
override val descriptor: ClassDescriptor get() = symbol.descriptor
|
override val descriptor: ClassDescriptor get() = symbol.descriptor
|
||||||
|
|
||||||
override var visibilityField: Visibility = visibility
|
override var visibilityField: Visibility = visibility
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.ir.declarations.impl
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.ClassConstructorDescriptor
|
import org.jetbrains.kotlin.descriptors.ClassConstructorDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.Visibility
|
import org.jetbrains.kotlin.descriptors.Visibility
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.carriers.ConstructorCarrier
|
import org.jetbrains.kotlin.ir.declarations.impl.carriers.ConstructorCarrier
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol
|
||||||
@@ -70,6 +71,7 @@ class IrConstructorImpl(
|
|||||||
symbol.bind(this)
|
symbol.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
override val descriptor: ClassConstructorDescriptor get() = symbol.descriptor
|
override val descriptor: ClassConstructorDescriptor get() = symbol.descriptor
|
||||||
|
|
||||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
|
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package org.jetbrains.kotlin.ir.declarations.impl
|
package org.jetbrains.kotlin.ir.declarations.impl
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrClass
|
import org.jetbrains.kotlin.ir.declarations.IrClass
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrEnumEntry
|
import org.jetbrains.kotlin.ir.declarations.IrEnumEntry
|
||||||
@@ -42,6 +43,7 @@ class IrEnumEntryImpl(
|
|||||||
symbol.bind(this)
|
symbol.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
override val descriptor: ClassDescriptor get() = symbol.descriptor
|
override val descriptor: ClassDescriptor get() = symbol.descriptor
|
||||||
|
|
||||||
override var correspondingClassField: IrClass? = null
|
override var correspondingClassField: IrClass? = null
|
||||||
|
|||||||
+2
@@ -17,12 +17,14 @@
|
|||||||
package org.jetbrains.kotlin.ir.declarations.impl
|
package org.jetbrains.kotlin.ir.declarations.impl
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrErrorDeclaration
|
import org.jetbrains.kotlin.ir.declarations.IrErrorDeclaration
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.carriers.ErrorCarrier
|
import org.jetbrains.kotlin.ir.declarations.impl.carriers.ErrorCarrier
|
||||||
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
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
class IrErrorDeclarationImpl(
|
class IrErrorDeclarationImpl(
|
||||||
startOffset: Int,
|
startOffset: Int,
|
||||||
endOffset: Int,
|
endOffset: Int,
|
||||||
|
|||||||
+3
@@ -19,6 +19,7 @@ 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.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.IrElementBase
|
import org.jetbrains.kotlin.ir.IrElementBase
|
||||||
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
|
||||||
@@ -40,10 +41,12 @@ class IrExternalPackageFragmentImpl(
|
|||||||
symbol.bind(this)
|
symbol.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
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(DescriptorBasedIr::class)
|
||||||
override val containerSource get() = (symbol.descriptor as? DeserializedMemberDescriptor)?.containerSource
|
override val containerSource 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 =
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.ir.declarations.impl
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.Visibility
|
import org.jetbrains.kotlin.descriptors.Visibility
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.carriers.FieldCarrier
|
import org.jetbrains.kotlin.ir.declarations.impl.carriers.FieldCarrier
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
|
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
|
||||||
@@ -69,6 +70,7 @@ class IrFieldImpl(
|
|||||||
symbol.bind(this)
|
symbol.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
override val descriptor: PropertyDescriptor = symbol.descriptor
|
override val descriptor: PropertyDescriptor = symbol.descriptor
|
||||||
|
|
||||||
override var initializerField: IrExpressionBody? = null
|
override var initializerField: IrExpressionBody? = null
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package org.jetbrains.kotlin.ir.declarations.impl
|
package org.jetbrains.kotlin.ir.declarations.impl
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor
|
import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.IrElementBase
|
import org.jetbrains.kotlin.ir.IrElementBase
|
||||||
import org.jetbrains.kotlin.ir.SourceManager
|
import org.jetbrains.kotlin.ir.SourceManager
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
@@ -44,6 +45,7 @@ class IrFileImpl(
|
|||||||
symbol.bind(this)
|
symbol.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
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()
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.ir.declarations.impl
|
|||||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.Modality
|
import org.jetbrains.kotlin.descriptors.Modality
|
||||||
import org.jetbrains.kotlin.descriptors.Visibility
|
import org.jetbrains.kotlin.descriptors.Visibility
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.carriers.FunctionCarrier
|
import org.jetbrains.kotlin.ir.declarations.impl.carriers.FunctionCarrier
|
||||||
import org.jetbrains.kotlin.ir.descriptors.WrappedSimpleFunctionDescriptor
|
import org.jetbrains.kotlin.ir.descriptors.WrappedSimpleFunctionDescriptor
|
||||||
@@ -38,6 +39,7 @@ abstract class IrFunctionCommonImpl(
|
|||||||
IrSimpleFunction,
|
IrSimpleFunction,
|
||||||
FunctionCarrier {
|
FunctionCarrier {
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
abstract override val descriptor: FunctionDescriptor
|
abstract override val descriptor: FunctionDescriptor
|
||||||
|
|
||||||
override var overriddenSymbolsField: List<IrSimpleFunctionSymbol> = emptyList()
|
override var overriddenSymbolsField: List<IrSimpleFunctionSymbol> = emptyList()
|
||||||
@@ -127,6 +129,7 @@ class IrFunctionImpl(
|
|||||||
IrSimpleFunctionSymbolImpl(descriptor), returnType, descriptor
|
IrSimpleFunctionSymbolImpl(descriptor), returnType, descriptor
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
override val descriptor: FunctionDescriptor get() = symbol.descriptor
|
override val descriptor: FunctionDescriptor get() = symbol.descriptor
|
||||||
|
|
||||||
init {
|
init {
|
||||||
@@ -160,9 +163,11 @@ class IrFakeOverrideFunctionImpl(
|
|||||||
override val symbol: IrSimpleFunctionSymbol
|
override val symbol: IrSimpleFunctionSymbol
|
||||||
get() = _symbol ?: error("$this has not acquired a symbol yet")
|
get() = _symbol ?: error("$this has not acquired a symbol yet")
|
||||||
|
|
||||||
override val descriptor get() =
|
@DescriptorBasedIr
|
||||||
_symbol?.descriptor ?: WrappedSimpleFunctionDescriptor()
|
override val descriptor
|
||||||
|
get() = _symbol?.descriptor ?: WrappedSimpleFunctionDescriptor()
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
fun acquireSymbol(symbol: IrSimpleFunctionSymbol) {
|
fun acquireSymbol(symbol: IrSimpleFunctionSymbol) {
|
||||||
assert(_symbol == null) { "$this already has symbol _symbol" }
|
assert(_symbol == null) { "$this already has symbol _symbol" }
|
||||||
_symbol = symbol
|
_symbol = symbol
|
||||||
|
|||||||
+2
@@ -17,6 +17,7 @@
|
|||||||
package org.jetbrains.kotlin.ir.declarations.impl
|
package org.jetbrains.kotlin.ir.declarations.impl
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.VariableDescriptorWithAccessors
|
import org.jetbrains.kotlin.descriptors.VariableDescriptorWithAccessors
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.carriers.LocalDelegatedPropertyCarrier
|
import org.jetbrains.kotlin.ir.declarations.impl.carriers.LocalDelegatedPropertyCarrier
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrLocalDelegatedPropertySymbol
|
import org.jetbrains.kotlin.ir.symbols.IrLocalDelegatedPropertySymbol
|
||||||
@@ -44,6 +45,7 @@ class IrLocalDelegatedPropertyImpl(
|
|||||||
symbol.bind(this)
|
symbol.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
override val descriptor: VariableDescriptorWithAccessors
|
override val descriptor: VariableDescriptorWithAccessors
|
||||||
get() = symbol.descriptor
|
get() = symbol.descriptor
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
|||||||
import org.jetbrains.kotlin.descriptors.Modality
|
import org.jetbrains.kotlin.descriptors.Modality
|
||||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.Visibility
|
import org.jetbrains.kotlin.descriptors.Visibility
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.carriers.PropertyCarrier
|
import org.jetbrains.kotlin.ir.declarations.impl.carriers.PropertyCarrier
|
||||||
import org.jetbrains.kotlin.ir.descriptors.WrappedPropertyDescriptor
|
import org.jetbrains.kotlin.ir.descriptors.WrappedPropertyDescriptor
|
||||||
@@ -49,6 +50,7 @@ abstract class IrPropertyCommonImpl(
|
|||||||
IrProperty,
|
IrProperty,
|
||||||
PropertyCarrier {
|
PropertyCarrier {
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
abstract override val descriptor: PropertyDescriptor
|
abstract override val descriptor: PropertyDescriptor
|
||||||
|
|
||||||
override var backingFieldField: IrField? = null
|
override var backingFieldField: IrField? = null
|
||||||
@@ -214,6 +216,8 @@ class IrPropertyImpl(
|
|||||||
init {
|
init {
|
||||||
symbol.bind(this)
|
symbol.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
override val descriptor: PropertyDescriptor = symbol.descriptor
|
override val descriptor: PropertyDescriptor = symbol.descriptor
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,9 +242,11 @@ class IrFakeOverridePropertyImpl(
|
|||||||
override val symbol: IrPropertySymbol
|
override val symbol: IrPropertySymbol
|
||||||
get() = _symbol ?: error("$this has not acquired a symbol yet")
|
get() = _symbol ?: error("$this has not acquired a symbol yet")
|
||||||
|
|
||||||
override val descriptor get() =
|
@DescriptorBasedIr
|
||||||
_symbol?.descriptor ?: WrappedPropertyDescriptor()
|
override val descriptor
|
||||||
|
get() = _symbol?.descriptor ?: WrappedPropertyDescriptor()
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
fun acquireSymbol(symbol: IrPropertySymbol) {
|
fun acquireSymbol(symbol: IrPropertySymbol) {
|
||||||
assert(_symbol == null) { "$this already has symbol _symbol" }
|
assert(_symbol == null) { "$this already has symbol _symbol" }
|
||||||
_symbol = symbol
|
_symbol = symbol
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.ir.declarations.impl
|
package org.jetbrains.kotlin.ir.declarations.impl
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.ScriptDescriptor
|
import org.jetbrains.kotlin.descriptors.ScriptDescriptor
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
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.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
@@ -42,6 +43,8 @@ class IrScriptImpl(
|
|||||||
override val statements: MutableList<IrStatement> = mutableListOf()
|
override val statements: MutableList<IrStatement> = mutableListOf()
|
||||||
|
|
||||||
override lateinit var thisReceiver: IrValueParameter
|
override lateinit var thisReceiver: IrValueParameter
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
override val descriptor: ScriptDescriptor = symbol.descriptor
|
override val descriptor: ScriptDescriptor = symbol.descriptor
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.ir.declarations.impl
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.TypeAliasDescriptor
|
import org.jetbrains.kotlin.descriptors.TypeAliasDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.Visibility
|
import org.jetbrains.kotlin.descriptors.Visibility
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrTypeAlias
|
import org.jetbrains.kotlin.ir.declarations.IrTypeAlias
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrTypeParameter
|
import org.jetbrains.kotlin.ir.declarations.IrTypeParameter
|
||||||
@@ -36,6 +37,7 @@ class IrTypeAliasImpl(
|
|||||||
symbol.bind(this)
|
symbol.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
override val descriptor: TypeAliasDescriptor
|
override val descriptor: TypeAliasDescriptor
|
||||||
get() = symbol.descriptor
|
get() = symbol.descriptor
|
||||||
|
|
||||||
|
|||||||
+2
@@ -17,6 +17,7 @@
|
|||||||
package org.jetbrains.kotlin.ir.declarations.impl
|
package org.jetbrains.kotlin.ir.declarations.impl
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrTypeParameter
|
import org.jetbrains.kotlin.ir.declarations.IrTypeParameter
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.carriers.TypeParameterCarrier
|
import org.jetbrains.kotlin.ir.declarations.impl.carriers.TypeParameterCarrier
|
||||||
@@ -60,6 +61,7 @@ class IrTypeParameterImpl(
|
|||||||
symbol.bind(this)
|
symbol.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
override val descriptor: TypeParameterDescriptor get() = symbol.descriptor
|
override val descriptor: TypeParameterDescriptor get() = symbol.descriptor
|
||||||
|
|
||||||
override val superTypes: MutableList<IrType> = SmartList()
|
override val superTypes: MutableList<IrType> = SmartList()
|
||||||
|
|||||||
+3
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.ir.declarations.impl
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.ParameterDescriptor
|
import org.jetbrains.kotlin.descriptors.ParameterDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrValueParameter
|
import org.jetbrains.kotlin.ir.declarations.IrValueParameter
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.carriers.ValueParameterCarrier
|
import org.jetbrains.kotlin.ir.declarations.impl.carriers.ValueParameterCarrier
|
||||||
@@ -46,6 +47,7 @@ class IrValueParameterImpl(
|
|||||||
IrValueParameter,
|
IrValueParameter,
|
||||||
ValueParameterCarrier {
|
ValueParameterCarrier {
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
constructor(
|
constructor(
|
||||||
startOffset: Int,
|
startOffset: Int,
|
||||||
endOffset: Int,
|
endOffset: Int,
|
||||||
@@ -64,6 +66,7 @@ class IrValueParameterImpl(
|
|||||||
isNoinline = descriptor.safeAs<ValueParameterDescriptor>()?.isNoinline ?: false
|
isNoinline = descriptor.safeAs<ValueParameterDescriptor>()?.isNoinline ?: false
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
override val descriptor: ParameterDescriptor = symbol.descriptor
|
override val descriptor: ParameterDescriptor = symbol.descriptor
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package org.jetbrains.kotlin.ir.declarations.impl
|
package org.jetbrains.kotlin.ir.declarations.impl
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.VariableDescriptor
|
import org.jetbrains.kotlin.descriptors.VariableDescriptor
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationParent
|
import org.jetbrains.kotlin.ir.declarations.IrDeclarationParent
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrVariable
|
import org.jetbrains.kotlin.ir.declarations.IrVariable
|
||||||
@@ -84,6 +85,7 @@ class IrVariableImpl(
|
|||||||
symbol.bind(this)
|
symbol.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
override val descriptor: VariableDescriptor get() = symbol.descriptor
|
override val descriptor: VariableDescriptor get() = symbol.descriptor
|
||||||
|
|
||||||
override var initializer: IrExpression? = null
|
override var initializer: IrExpression? = null
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.ir.declarations.lazy
|
package org.jetbrains.kotlin.ir.declarations.lazy
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
||||||
import org.jetbrains.kotlin.ir.types.IrType
|
import org.jetbrains.kotlin.ir.types.IrType
|
||||||
@@ -20,6 +21,7 @@ import org.jetbrains.kotlin.metadata.deserialization.NameResolver
|
|||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedClassDescriptor
|
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedClassDescriptor
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
class IrLazyClass(
|
class IrLazyClass(
|
||||||
startOffset: Int,
|
startOffset: Int,
|
||||||
endOffset: Int,
|
endOffset: Int,
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.ir.declarations.lazy
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.ClassConstructorDescriptor
|
import org.jetbrains.kotlin.descriptors.ClassConstructorDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.Visibility
|
import org.jetbrains.kotlin.descriptors.Visibility
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrConstructor
|
import org.jetbrains.kotlin.ir.declarations.IrConstructor
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrTypeParameter
|
import org.jetbrains.kotlin.ir.declarations.IrTypeParameter
|
||||||
@@ -17,6 +18,7 @@ import org.jetbrains.kotlin.ir.util.withScope
|
|||||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
class IrLazyConstructor(
|
class IrLazyConstructor(
|
||||||
startOffset: Int,
|
startOffset: Int,
|
||||||
endOffset: Int,
|
endOffset: Int,
|
||||||
|
|||||||
+2
@@ -6,6 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.ir.declarations.lazy
|
package org.jetbrains.kotlin.ir.declarations.lazy
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.IrElementBase
|
import org.jetbrains.kotlin.ir.IrElementBase
|
||||||
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
@@ -16,6 +17,7 @@ import org.jetbrains.kotlin.ir.util.TypeTranslator
|
|||||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
||||||
import org.jetbrains.kotlin.types.KotlinType
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
abstract class IrLazyDeclarationBase(
|
abstract class IrLazyDeclarationBase(
|
||||||
startOffset: Int,
|
startOffset: Int,
|
||||||
endOffset: Int,
|
endOffset: Int,
|
||||||
|
|||||||
+2
@@ -17,6 +17,7 @@
|
|||||||
package org.jetbrains.kotlin.ir.declarations.lazy
|
package org.jetbrains.kotlin.ir.declarations.lazy
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrClass
|
import org.jetbrains.kotlin.ir.declarations.IrClass
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrEnumEntry
|
import org.jetbrains.kotlin.ir.declarations.IrEnumEntry
|
||||||
@@ -28,6 +29,7 @@ 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.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
class IrLazyEnumEntryImpl(
|
class IrLazyEnumEntryImpl(
|
||||||
startOffset: Int,
|
startOffset: Int,
|
||||||
endOffset: Int,
|
endOffset: Int,
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.ir.declarations.lazy
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.Visibility
|
import org.jetbrains.kotlin.descriptors.Visibility
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrField
|
import org.jetbrains.kotlin.ir.declarations.IrField
|
||||||
@@ -22,6 +23,7 @@ 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.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
class IrLazyField(
|
class IrLazyField(
|
||||||
startOffset: Int,
|
startOffset: Int,
|
||||||
endOffset: Int,
|
endOffset: Int,
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.ir.declarations.lazy
|
|||||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.Modality
|
import org.jetbrains.kotlin.descriptors.Modality
|
||||||
import org.jetbrains.kotlin.descriptors.Visibility
|
import org.jetbrains.kotlin.descriptors.Visibility
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrPropertySymbol
|
import org.jetbrains.kotlin.ir.symbols.IrPropertySymbol
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
|
||||||
@@ -18,6 +19,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
|||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.propertyIfAccessor
|
import org.jetbrains.kotlin.resolve.descriptorUtil.propertyIfAccessor
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
class IrLazyFunction(
|
class IrLazyFunction(
|
||||||
startOffset: Int,
|
startOffset: Int,
|
||||||
endOffset: Int,
|
endOffset: Int,
|
||||||
|
|||||||
+2
@@ -6,6 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.ir.declarations.lazy
|
package org.jetbrains.kotlin.ir.declarations.lazy
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.Visibility
|
import org.jetbrains.kotlin.descriptors.Visibility
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrFunction
|
import org.jetbrains.kotlin.ir.declarations.IrFunction
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrValueParameter
|
import org.jetbrains.kotlin.ir.declarations.IrValueParameter
|
||||||
@@ -18,6 +19,7 @@ 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.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
abstract class IrLazyFunctionBase(
|
abstract class IrLazyFunctionBase(
|
||||||
startOffset: Int,
|
startOffset: Int,
|
||||||
endOffset: Int,
|
endOffset: Int,
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.ir.declarations.lazy
|
|||||||
import org.jetbrains.kotlin.descriptors.Modality
|
import org.jetbrains.kotlin.descriptors.Modality
|
||||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.Visibility
|
import org.jetbrains.kotlin.descriptors.Visibility
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrField
|
import org.jetbrains.kotlin.ir.declarations.IrField
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrProperty
|
import org.jetbrains.kotlin.ir.declarations.IrProperty
|
||||||
@@ -21,6 +22,7 @@ import org.jetbrains.kotlin.name.Name
|
|||||||
import org.jetbrains.kotlin.resolve.BindingContext
|
import org.jetbrains.kotlin.resolve.BindingContext
|
||||||
import org.jetbrains.kotlin.resolve.hasBackingField
|
import org.jetbrains.kotlin.resolve.hasBackingField
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
class IrLazyProperty(
|
class IrLazyProperty(
|
||||||
startOffset: Int,
|
startOffset: Int,
|
||||||
endOffset: Int,
|
endOffset: Int,
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.ir.declarations.lazy
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.TypeAliasDescriptor
|
import org.jetbrains.kotlin.descriptors.TypeAliasDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.Visibility
|
import org.jetbrains.kotlin.descriptors.Visibility
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrTypeAlias
|
import org.jetbrains.kotlin.ir.declarations.IrTypeAlias
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrTypeParameter
|
import org.jetbrains.kotlin.ir.declarations.IrTypeParameter
|
||||||
@@ -20,6 +21,7 @@ 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.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
class IrLazyTypeAlias(
|
class IrLazyTypeAlias(
|
||||||
startOffset: Int,
|
startOffset: Int,
|
||||||
endOffset: Int,
|
endOffset: Int,
|
||||||
|
|||||||
+2
@@ -6,6 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.ir.declarations.lazy
|
package org.jetbrains.kotlin.ir.declarations.lazy
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrTypeParameter
|
import org.jetbrains.kotlin.ir.declarations.IrTypeParameter
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrTypeParametersContainer
|
import org.jetbrains.kotlin.ir.declarations.IrTypeParametersContainer
|
||||||
@@ -19,6 +20,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
|||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.types.Variance
|
import org.jetbrains.kotlin.types.Variance
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
class IrLazyTypeParameter(
|
class IrLazyTypeParameter(
|
||||||
startOffset: Int,
|
startOffset: Int,
|
||||||
endOffset: Int,
|
endOffset: Int,
|
||||||
|
|||||||
+2
@@ -6,6 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.ir.declarations.lazy
|
package org.jetbrains.kotlin.ir.declarations.lazy
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrTypeParametersContainer
|
import org.jetbrains.kotlin.ir.declarations.IrTypeParametersContainer
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
|
||||||
import org.jetbrains.kotlin.ir.util.ReferenceSymbolTable
|
import org.jetbrains.kotlin.ir.util.ReferenceSymbolTable
|
||||||
@@ -26,6 +27,7 @@ class LazyScopedTypeParametersResolver(private val symbolTable: ReferenceSymbolT
|
|||||||
typeParameterScopes.removeFirst()
|
typeParameterScopes.removeFirst()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DescriptorBasedIr
|
||||||
override fun resolveScopedTypeParameter(typeParameterDescriptor: TypeParameterDescriptor): IrTypeParameterSymbol? {
|
override fun resolveScopedTypeParameter(typeParameterDescriptor: TypeParameterDescriptor): IrTypeParameterSymbol? {
|
||||||
//Just support accessor scoped symbols resolve in external declaration
|
//Just support accessor scoped symbols resolve in external declaration
|
||||||
//there should be enough to process only parent typeparameters
|
//there should be enough to process only parent typeparameters
|
||||||
|
|||||||
@@ -286,8 +286,6 @@ class IrBuiltIns(
|
|||||||
|
|
||||||
val checkNotNullSymbol = defineCheckNotNullOperator()
|
val checkNotNullSymbol = defineCheckNotNullOperator()
|
||||||
|
|
||||||
val checkNotNull = checkNotNullSymbol.descriptor
|
|
||||||
|
|
||||||
private fun TypeConstructor.makeNonNullType() = KotlinTypeFactory.simpleType(Annotations.EMPTY, this, listOf(), false)
|
private fun TypeConstructor.makeNonNullType() = KotlinTypeFactory.simpleType(Annotations.EMPTY, this, listOf(), false)
|
||||||
private fun TypeConstructor.makeNullableType() = KotlinTypeFactory.simpleType(Annotations.EMPTY, this, listOf(), true)
|
private fun TypeConstructor.makeNullableType() = KotlinTypeFactory.simpleType(Annotations.EMPTY, this, listOf(), true)
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import org.jetbrains.kotlin.builtins.KOTLIN_REFLECT_FQ_NAME
|
|||||||
import org.jetbrains.kotlin.builtins.functions.FunctionClassDescriptor
|
import org.jetbrains.kotlin.builtins.functions.FunctionClassDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||||
|
import org.jetbrains.kotlin.ir.DescriptorBasedIr
|
||||||
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.symbols.IrClassSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
||||||
@@ -26,6 +27,7 @@ import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
|||||||
import org.jetbrains.kotlin.types.KotlinType
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
import org.jetbrains.kotlin.types.Variance
|
import org.jetbrains.kotlin.types.Variance
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
abstract class IrAbstractFunctionFactory {
|
abstract class IrAbstractFunctionFactory {
|
||||||
|
|
||||||
abstract fun functionClassDescriptor(arity: Int): FunctionClassDescriptor
|
abstract fun functionClassDescriptor(arity: Int): FunctionClassDescriptor
|
||||||
@@ -75,6 +77,7 @@ abstract class IrAbstractFunctionFactory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(DescriptorBasedIr::class)
|
||||||
class IrFunctionFactory(private val irBuiltIns: IrBuiltIns, private val symbolTable: SymbolTable) : IrAbstractFunctionFactory() {
|
class IrFunctionFactory(private val irBuiltIns: IrBuiltIns, private val symbolTable: SymbolTable) : IrAbstractFunctionFactory() {
|
||||||
|
|
||||||
// TODO: Lazieness
|
// TODO: Lazieness
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user