From a140d75016e382a9f86041b53888bacf05bf9c31 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Tue, 30 Aug 2016 12:08:13 +0300 Subject: [PATCH] Minor: IrSyntheticPropertyAccessorDescriptor.Kind. --- .../generators/SyntheticDescriptorsFactory.kt | 10 ++++--- ... IrSyntheticPropertyAccessorDescriptor.kt} | 26 ++++++++++++------- 2 files changed, 23 insertions(+), 13 deletions(-) rename compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/{IrSyntheticStaticPropertyAccessorDescriptor.kt => IrSyntheticPropertyAccessorDescriptor.kt} (71%) diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/SyntheticDescriptorsFactory.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/SyntheticDescriptorsFactory.kt index c3044ff444a..6bff85e91ff 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/SyntheticDescriptorsFactory.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/SyntheticDescriptorsFactory.kt @@ -20,9 +20,11 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.PropertyDescriptor import org.jetbrains.kotlin.descriptors.PropertyGetterDescriptor import org.jetbrains.kotlin.descriptors.PropertySetterDescriptor -import org.jetbrains.kotlin.ir.descriptors.IrSyntheticStaticPropertyGetterDescriptorImpl -import org.jetbrains.kotlin.ir.descriptors.IrSyntheticStaticPropertySetterDescriptorImpl +import org.jetbrains.kotlin.ir.descriptors.IrSyntheticPropertyAccessorDescriptor.Kind.STATIC_PROPERTY +import org.jetbrains.kotlin.ir.descriptors.IrSyntheticPropertyGetterDescriptorImpl +import org.jetbrains.kotlin.ir.descriptors.IrSyntheticPropertySetterDescriptorImpl import org.jetbrains.kotlin.storage.StorageManager +import java.lang.AssertionError class SyntheticDescriptorsFactory(storageManager: StorageManager) { @@ -30,7 +32,7 @@ class SyntheticDescriptorsFactory(storageManager: StorageManager) { property -> when { isStaticPropertyInClass(property) -> - IrSyntheticStaticPropertyGetterDescriptorImpl(property) + IrSyntheticPropertyGetterDescriptorImpl(property, STATIC_PROPERTY) else -> throw AssertionError("Don't know how to create synthetic getter for $property") } @@ -40,7 +42,7 @@ class SyntheticDescriptorsFactory(storageManager: StorageManager) { property -> when { isStaticPropertyInClass(property) -> - IrSyntheticStaticPropertySetterDescriptorImpl(property) + IrSyntheticPropertySetterDescriptorImpl(property, STATIC_PROPERTY) else -> throw AssertionError("Don't know how to create synthetic setter for $property") } diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrSyntheticStaticPropertyAccessorDescriptor.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrSyntheticPropertyAccessorDescriptor.kt similarity index 71% rename from compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrSyntheticStaticPropertyAccessorDescriptor.kt rename to compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrSyntheticPropertyAccessorDescriptor.kt index a32ae0cb7da..61537a6913d 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrSyntheticStaticPropertyAccessorDescriptor.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrSyntheticPropertyAccessorDescriptor.kt @@ -25,14 +25,21 @@ import org.jetbrains.kotlin.descriptors.impl.PropertyGetterDescriptorImpl import org.jetbrains.kotlin.descriptors.impl.PropertySetterDescriptorImpl -interface IrSyntheticStaticPropertyAccessorDescriptor : PropertyAccessorDescriptor +interface IrSyntheticPropertyAccessorDescriptor : PropertyAccessorDescriptor { + enum class Kind { + STATIC_PROPERTY + } -interface IrSyntheticStaticPropertyGetterDescriptor : IrSyntheticStaticPropertyAccessorDescriptor + val kind: Kind +} -interface IrSyntheticStaticPropertySetterDescriptor : IrSyntheticStaticPropertyAccessorDescriptor +interface IrSyntheticPropertyGetterDescriptor : IrSyntheticPropertyAccessorDescriptor -class IrSyntheticStaticPropertyGetterDescriptorImpl( - correspondingProperty: PropertyDescriptor +interface IrSyntheticPropertySetterDescriptor : IrSyntheticPropertyAccessorDescriptor + +class IrSyntheticPropertyGetterDescriptorImpl( + correspondingProperty: PropertyDescriptor, + override val kind: IrSyntheticPropertyAccessorDescriptor.Kind ) : PropertyGetterDescriptorImpl( correspondingProperty, Annotations.EMPTY, @@ -44,14 +51,15 @@ class IrSyntheticStaticPropertyGetterDescriptorImpl( CallableMemberDescriptor.Kind.SYNTHESIZED, null, correspondingProperty.source -), IrSyntheticStaticPropertyGetterDescriptor { +), IrSyntheticPropertyGetterDescriptor { init { initialize(correspondingProperty.type) } } -class IrSyntheticStaticPropertySetterDescriptorImpl( - correspondingProperty: PropertyDescriptor +class IrSyntheticPropertySetterDescriptorImpl( + correspondingProperty: PropertyDescriptor, + override val kind: IrSyntheticPropertyAccessorDescriptor.Kind ) : PropertySetterDescriptorImpl( correspondingProperty, Annotations.EMPTY, @@ -63,7 +71,7 @@ class IrSyntheticStaticPropertySetterDescriptorImpl( CallableMemberDescriptor.Kind.SYNTHESIZED, null, correspondingProperty.source -), IrSyntheticStaticPropertySetterDescriptor { +), IrSyntheticPropertySetterDescriptor { init { initializeDefault() }