Move declaration origins to IrDeclarationOrigin.kt
This commit is contained in:
@@ -25,6 +25,7 @@ interface JvmLoweredDeclarationOrigin : IrDeclarationOrigin {
|
|||||||
object CLASS_STATIC_INITIALIZER : IrDeclarationOriginImpl("CLASS_STATIC_INITIALIZER")
|
object CLASS_STATIC_INITIALIZER : IrDeclarationOriginImpl("CLASS_STATIC_INITIALIZER")
|
||||||
object DEFAULT_IMPLS : IrDeclarationOriginImpl("DEFAULT_IMPL")
|
object DEFAULT_IMPLS : IrDeclarationOriginImpl("DEFAULT_IMPL")
|
||||||
object FIELD_FOR_OUTER_THIS : IrDeclarationOriginImpl("FIELD_FOR_OUTER_THIS")
|
object FIELD_FOR_OUTER_THIS : IrDeclarationOriginImpl("FIELD_FOR_OUTER_THIS")
|
||||||
|
object FUNCTION_REFERENCE_IMPL : IrDeclarationOriginImpl("FUNCTION_REFERENCE_IMPL")
|
||||||
object SYNTHETIC_ACCESSOR : IrDeclarationOriginImpl("SYNTHETIC_ACCESSOR", isSynthetic = true)
|
object SYNTHETIC_ACCESSOR : IrDeclarationOriginImpl("SYNTHETIC_ACCESSOR", isSynthetic = true)
|
||||||
object TO_ARRAY : IrDeclarationOriginImpl("TO_ARRAY")
|
object TO_ARRAY : IrDeclarationOriginImpl("TO_ARRAY")
|
||||||
object JVM_STATIC_WRAPPER : IrDeclarationOriginImpl("JVM_STATIC_WRAPPER")
|
object JVM_STATIC_WRAPPER : IrDeclarationOriginImpl("JVM_STATIC_WRAPPER")
|
||||||
|
|||||||
-1
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.backend.jvm.codegen
|
package org.jetbrains.kotlin.backend.jvm.codegen
|
||||||
|
|
||||||
import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin
|
|
||||||
import org.jetbrains.kotlin.backend.jvm.descriptors.JvmDescriptorWithExtraFlags
|
import org.jetbrains.kotlin.backend.jvm.descriptors.JvmDescriptorWithExtraFlags
|
||||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns.FQ_NAMES
|
import org.jetbrains.kotlin.builtins.KotlinBuiltIns.FQ_NAMES
|
||||||
import org.jetbrains.kotlin.codegen.*
|
import org.jetbrains.kotlin.codegen.*
|
||||||
|
|||||||
+8
-9
@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.backend.common.ir.copyTo
|
|||||||
import org.jetbrains.kotlin.backend.common.ir.createImplicitParameterDeclarationWithWrappedDescriptor
|
import org.jetbrains.kotlin.backend.common.ir.createImplicitParameterDeclarationWithWrappedDescriptor
|
||||||
import org.jetbrains.kotlin.backend.common.lower.*
|
import org.jetbrains.kotlin.backend.common.lower.*
|
||||||
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
|
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
|
||||||
|
import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin
|
||||||
import org.jetbrains.kotlin.backend.jvm.codegen.isInlineIrExpression
|
import org.jetbrains.kotlin.backend.jvm.codegen.isInlineIrExpression
|
||||||
import org.jetbrains.kotlin.codegen.PropertyReferenceCodegen
|
import org.jetbrains.kotlin.codegen.PropertyReferenceCodegen
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
@@ -53,8 +54,6 @@ class CrIrType(val type: Type) : IrType {
|
|||||||
//Originally was copied from K/Native
|
//Originally was copied from K/Native
|
||||||
class CallableReferenceLowering(val context: JvmBackendContext) : FileLoweringPass {
|
class CallableReferenceLowering(val context: JvmBackendContext) : FileLoweringPass {
|
||||||
|
|
||||||
object DECLARATION_ORIGIN_FUNCTION_REFERENCE_IMPL : IrDeclarationOriginImpl("FUNCTION_REFERENCE_IMPL")
|
|
||||||
|
|
||||||
private var functionReferenceCount = 0
|
private var functionReferenceCount = 0
|
||||||
|
|
||||||
private val inlineLambdaReferences = mutableSetOf<IrFunctionReference>()
|
private val inlineLambdaReferences = mutableSetOf<IrFunctionReference>()
|
||||||
@@ -218,7 +217,7 @@ class CallableReferenceLowering(val context: JvmBackendContext) : FileLoweringPa
|
|||||||
val functionReferenceClassDescriptor = WrappedClassDescriptor()
|
val functionReferenceClassDescriptor = WrappedClassDescriptor()
|
||||||
functionReferenceClass = IrClassImpl(
|
functionReferenceClass = IrClassImpl(
|
||||||
startOffset, endOffset,
|
startOffset, endOffset,
|
||||||
DECLARATION_ORIGIN_FUNCTION_REFERENCE_IMPL,
|
JvmLoweredDeclarationOrigin.FUNCTION_REFERENCE_IMPL,
|
||||||
IrClassSymbolImpl(functionReferenceClassDescriptor),
|
IrClassSymbolImpl(functionReferenceClassDescriptor),
|
||||||
name = "${callee.name}\$${functionReferenceCount++}".synthesizedName,
|
name = "${callee.name}\$${functionReferenceCount++}".synthesizedName,
|
||||||
kind = ClassKind.CLASS,
|
kind = ClassKind.CLASS,
|
||||||
@@ -274,7 +273,7 @@ class CallableReferenceLowering(val context: JvmBackendContext) : FileLoweringPa
|
|||||||
val descriptor = WrappedClassConstructorDescriptor()
|
val descriptor = WrappedClassConstructorDescriptor()
|
||||||
return IrConstructorImpl(
|
return IrConstructorImpl(
|
||||||
irFunctionReference.startOffset, irFunctionReference.endOffset,
|
irFunctionReference.startOffset, irFunctionReference.endOffset,
|
||||||
DECLARATION_ORIGIN_FUNCTION_REFERENCE_IMPL,
|
JvmLoweredDeclarationOrigin.FUNCTION_REFERENCE_IMPL,
|
||||||
IrConstructorSymbolImpl(descriptor),
|
IrConstructorSymbolImpl(descriptor),
|
||||||
name = Name.special("<init>"),
|
name = Name.special("<init>"),
|
||||||
visibility = Visibilities.PUBLIC,
|
visibility = Visibilities.PUBLIC,
|
||||||
@@ -341,7 +340,7 @@ class CallableReferenceLowering(val context: JvmBackendContext) : FileLoweringPa
|
|||||||
val descriptor = WrappedSimpleFunctionDescriptor()
|
val descriptor = WrappedSimpleFunctionDescriptor()
|
||||||
return IrFunctionImpl(
|
return IrFunctionImpl(
|
||||||
irFunctionReference.startOffset, irFunctionReference.endOffset,
|
irFunctionReference.startOffset, irFunctionReference.endOffset,
|
||||||
DECLARATION_ORIGIN_FUNCTION_REFERENCE_IMPL,
|
JvmLoweredDeclarationOrigin.FUNCTION_REFERENCE_IMPL,
|
||||||
IrSimpleFunctionSymbolImpl(descriptor),
|
IrSimpleFunctionSymbolImpl(descriptor),
|
||||||
Name.identifier("invoke"),
|
Name.identifier("invoke"),
|
||||||
Visibilities.PUBLIC,
|
Visibilities.PUBLIC,
|
||||||
@@ -450,7 +449,7 @@ class CallableReferenceLowering(val context: JvmBackendContext) : FileLoweringPa
|
|||||||
val field = IrFieldImpl(
|
val field = IrFieldImpl(
|
||||||
irFunctionReference.startOffset,
|
irFunctionReference.startOffset,
|
||||||
irFunctionReference.endOffset,
|
irFunctionReference.endOffset,
|
||||||
DECLARATION_ORIGIN_FUNCTION_REFERENCE_IMPL,
|
JvmLoweredDeclarationOrigin.FUNCTION_REFERENCE_IMPL,
|
||||||
IrFieldSymbolImpl(descriptor),
|
IrFieldSymbolImpl(descriptor),
|
||||||
name,
|
name,
|
||||||
type,
|
type,
|
||||||
@@ -470,7 +469,7 @@ class CallableReferenceLowering(val context: JvmBackendContext) : FileLoweringPa
|
|||||||
val descriptor = WrappedSimpleFunctionDescriptor()
|
val descriptor = WrappedSimpleFunctionDescriptor()
|
||||||
return IrFunctionImpl(
|
return IrFunctionImpl(
|
||||||
irFunctionReference.startOffset, irFunctionReference.endOffset,
|
irFunctionReference.startOffset, irFunctionReference.endOffset,
|
||||||
DECLARATION_ORIGIN_FUNCTION_REFERENCE_IMPL,
|
JvmLoweredDeclarationOrigin.FUNCTION_REFERENCE_IMPL,
|
||||||
IrSimpleFunctionSymbolImpl(descriptor),
|
IrSimpleFunctionSymbolImpl(descriptor),
|
||||||
Name.identifier("getSignature"),
|
Name.identifier("getSignature"),
|
||||||
superFunction.visibility,
|
superFunction.visibility,
|
||||||
@@ -506,7 +505,7 @@ class CallableReferenceLowering(val context: JvmBackendContext) : FileLoweringPa
|
|||||||
val descriptor = WrappedSimpleFunctionDescriptor()
|
val descriptor = WrappedSimpleFunctionDescriptor()
|
||||||
return IrFunctionImpl(
|
return IrFunctionImpl(
|
||||||
irFunctionReference.startOffset, irFunctionReference.endOffset,
|
irFunctionReference.startOffset, irFunctionReference.endOffset,
|
||||||
DECLARATION_ORIGIN_FUNCTION_REFERENCE_IMPL,
|
JvmLoweredDeclarationOrigin.FUNCTION_REFERENCE_IMPL,
|
||||||
IrSimpleFunctionSymbolImpl(descriptor),
|
IrSimpleFunctionSymbolImpl(descriptor),
|
||||||
Name.identifier("getName"),
|
Name.identifier("getName"),
|
||||||
superGetter.visibility,
|
superGetter.visibility,
|
||||||
@@ -536,7 +535,7 @@ class CallableReferenceLowering(val context: JvmBackendContext) : FileLoweringPa
|
|||||||
val descriptor = WrappedSimpleFunctionDescriptor()
|
val descriptor = WrappedSimpleFunctionDescriptor()
|
||||||
return IrFunctionImpl(
|
return IrFunctionImpl(
|
||||||
functionReferenceClass.startOffset, functionReferenceClass.endOffset,
|
functionReferenceClass.startOffset, functionReferenceClass.endOffset,
|
||||||
DECLARATION_ORIGIN_FUNCTION_REFERENCE_IMPL,
|
JvmLoweredDeclarationOrigin.FUNCTION_REFERENCE_IMPL,
|
||||||
IrSimpleFunctionSymbolImpl(descriptor),
|
IrSimpleFunctionSymbolImpl(descriptor),
|
||||||
Name.identifier("getOwner"),
|
Name.identifier("getOwner"),
|
||||||
superFunction.visibility,
|
superFunction.visibility,
|
||||||
|
|||||||
+3
-3
@@ -10,8 +10,8 @@ import org.jetbrains.kotlin.backend.common.descriptors.WrappedSimpleFunctionDesc
|
|||||||
import org.jetbrains.kotlin.backend.common.descriptors.WrappedValueParameterDescriptor
|
import org.jetbrains.kotlin.backend.common.descriptors.WrappedValueParameterDescriptor
|
||||||
import org.jetbrains.kotlin.backend.common.lower.createIrBuilder
|
import org.jetbrains.kotlin.backend.common.lower.createIrBuilder
|
||||||
import org.jetbrains.kotlin.backend.common.lower.irIfThen
|
import org.jetbrains.kotlin.backend.common.lower.irIfThen
|
||||||
import org.jetbrains.kotlin.backend.common.makePhase
|
|
||||||
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
|
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
|
||||||
|
import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin
|
||||||
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.UNDEFINED_OFFSET
|
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
||||||
@@ -52,7 +52,7 @@ class FunctionNVarargInvokeLowering(var context: JvmBackendContext) : ClassLower
|
|||||||
val descriptor = WrappedSimpleFunctionDescriptor()
|
val descriptor = WrappedSimpleFunctionDescriptor()
|
||||||
return IrFunctionImpl(
|
return IrFunctionImpl(
|
||||||
UNDEFINED_OFFSET, UNDEFINED_OFFSET,
|
UNDEFINED_OFFSET, UNDEFINED_OFFSET,
|
||||||
origin = CallableReferenceLowering.DECLARATION_ORIGIN_FUNCTION_REFERENCE_IMPL,
|
origin = JvmLoweredDeclarationOrigin.FUNCTION_REFERENCE_IMPL,
|
||||||
symbol = IrSimpleFunctionSymbolImpl(descriptor),
|
symbol = IrSimpleFunctionSymbolImpl(descriptor),
|
||||||
name = Name.identifier("invoke"),
|
name = Name.identifier("invoke"),
|
||||||
visibility = Visibilities.PUBLIC,
|
visibility = Visibilities.PUBLIC,
|
||||||
@@ -68,7 +68,7 @@ class FunctionNVarargInvokeLowering(var context: JvmBackendContext) : ClassLower
|
|||||||
val varargParameterDescriptor = WrappedValueParameterDescriptor()
|
val varargParameterDescriptor = WrappedValueParameterDescriptor()
|
||||||
val varargParam = IrValueParameterImpl(
|
val varargParam = IrValueParameterImpl(
|
||||||
UNDEFINED_OFFSET, UNDEFINED_OFFSET,
|
UNDEFINED_OFFSET, UNDEFINED_OFFSET,
|
||||||
origin = CallableReferenceLowering.DECLARATION_ORIGIN_FUNCTION_REFERENCE_IMPL,
|
origin = JvmLoweredDeclarationOrigin.FUNCTION_REFERENCE_IMPL,
|
||||||
symbol = IrValueParameterSymbolImpl(varargParameterDescriptor),
|
symbol = IrValueParameterSymbolImpl(varargParameterDescriptor),
|
||||||
name = Name.identifier("args"),
|
name = Name.identifier("args"),
|
||||||
index = 0,
|
index = 0,
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ interface IrDeclarationOrigin {
|
|||||||
object DELEGATED_PROPERTY_ACCESSOR : IrDeclarationOriginImpl("DELEGATED_PROPERTY_ACCESSOR")
|
object DELEGATED_PROPERTY_ACCESSOR : IrDeclarationOriginImpl("DELEGATED_PROPERTY_ACCESSOR")
|
||||||
object DELEGATED_MEMBER : IrDeclarationOriginImpl("DELEGATED_MEMBER")
|
object DELEGATED_MEMBER : IrDeclarationOriginImpl("DELEGATED_MEMBER")
|
||||||
object ENUM_CLASS_SPECIAL_MEMBER : IrDeclarationOriginImpl("ENUM_CLASS_SPECIAL_MEMBER")
|
object ENUM_CLASS_SPECIAL_MEMBER : IrDeclarationOriginImpl("ENUM_CLASS_SPECIAL_MEMBER")
|
||||||
object FUNCTION_FOR_DEFAULT_PARAMETER : IrDeclarationOriginImpl("FUNCTION_FOR_DEFAULT_PARAMETER")
|
object FUNCTION_FOR_DEFAULT_PARAMETER : IrDeclarationOriginImpl("FUNCTION_FOR_DEFAULT_PARAMETER", isSynthetic = true)
|
||||||
object FILE_CLASS : IrDeclarationOriginImpl("FILE_CLASS")
|
object FILE_CLASS : IrDeclarationOriginImpl("FILE_CLASS")
|
||||||
object GENERATED_DATA_CLASS_MEMBER : IrDeclarationOriginImpl("GENERATED_DATA_CLASS_MEMBER")
|
object GENERATED_DATA_CLASS_MEMBER : IrDeclarationOriginImpl("GENERATED_DATA_CLASS_MEMBER")
|
||||||
object GENERATED_INLINE_CLASS_MEMBER : IrDeclarationOriginImpl("GENERATED_INLINE_CLASS_MEMBER")
|
object GENERATED_INLINE_CLASS_MEMBER : IrDeclarationOriginImpl("GENERATED_INLINE_CLASS_MEMBER")
|
||||||
|
|||||||
Reference in New Issue
Block a user