Minor: IrSyntheticPropertyAccessorDescriptor.Kind.

This commit is contained in:
Dmitry Petrov
2016-08-30 12:08:13 +03:00
committed by Dmitry Petrov
parent 7adf173a66
commit a140d75016
2 changed files with 23 additions and 13 deletions
@@ -20,9 +20,11 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.PropertyDescriptor import org.jetbrains.kotlin.descriptors.PropertyDescriptor
import org.jetbrains.kotlin.descriptors.PropertyGetterDescriptor import org.jetbrains.kotlin.descriptors.PropertyGetterDescriptor
import org.jetbrains.kotlin.descriptors.PropertySetterDescriptor import org.jetbrains.kotlin.descriptors.PropertySetterDescriptor
import org.jetbrains.kotlin.ir.descriptors.IrSyntheticStaticPropertyGetterDescriptorImpl import org.jetbrains.kotlin.ir.descriptors.IrSyntheticPropertyAccessorDescriptor.Kind.STATIC_PROPERTY
import org.jetbrains.kotlin.ir.descriptors.IrSyntheticStaticPropertySetterDescriptorImpl import org.jetbrains.kotlin.ir.descriptors.IrSyntheticPropertyGetterDescriptorImpl
import org.jetbrains.kotlin.ir.descriptors.IrSyntheticPropertySetterDescriptorImpl
import org.jetbrains.kotlin.storage.StorageManager import org.jetbrains.kotlin.storage.StorageManager
import java.lang.AssertionError
class SyntheticDescriptorsFactory(storageManager: StorageManager) { class SyntheticDescriptorsFactory(storageManager: StorageManager) {
@@ -30,7 +32,7 @@ class SyntheticDescriptorsFactory(storageManager: StorageManager) {
property -> property ->
when { when {
isStaticPropertyInClass(property) -> isStaticPropertyInClass(property) ->
IrSyntheticStaticPropertyGetterDescriptorImpl(property) IrSyntheticPropertyGetterDescriptorImpl(property, STATIC_PROPERTY)
else -> else ->
throw AssertionError("Don't know how to create synthetic getter for $property") throw AssertionError("Don't know how to create synthetic getter for $property")
} }
@@ -40,7 +42,7 @@ class SyntheticDescriptorsFactory(storageManager: StorageManager) {
property -> property ->
when { when {
isStaticPropertyInClass(property) -> isStaticPropertyInClass(property) ->
IrSyntheticStaticPropertySetterDescriptorImpl(property) IrSyntheticPropertySetterDescriptorImpl(property, STATIC_PROPERTY)
else -> else ->
throw AssertionError("Don't know how to create synthetic setter for $property") throw AssertionError("Don't know how to create synthetic setter for $property")
} }
@@ -25,14 +25,21 @@ import org.jetbrains.kotlin.descriptors.impl.PropertyGetterDescriptorImpl
import org.jetbrains.kotlin.descriptors.impl.PropertySetterDescriptorImpl 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( interface IrSyntheticPropertySetterDescriptor : IrSyntheticPropertyAccessorDescriptor
correspondingProperty: PropertyDescriptor
class IrSyntheticPropertyGetterDescriptorImpl(
correspondingProperty: PropertyDescriptor,
override val kind: IrSyntheticPropertyAccessorDescriptor.Kind
) : PropertyGetterDescriptorImpl( ) : PropertyGetterDescriptorImpl(
correspondingProperty, correspondingProperty,
Annotations.EMPTY, Annotations.EMPTY,
@@ -44,14 +51,15 @@ class IrSyntheticStaticPropertyGetterDescriptorImpl(
CallableMemberDescriptor.Kind.SYNTHESIZED, CallableMemberDescriptor.Kind.SYNTHESIZED,
null, null,
correspondingProperty.source correspondingProperty.source
), IrSyntheticStaticPropertyGetterDescriptor { ), IrSyntheticPropertyGetterDescriptor {
init { init {
initialize(correspondingProperty.type) initialize(correspondingProperty.type)
} }
} }
class IrSyntheticStaticPropertySetterDescriptorImpl( class IrSyntheticPropertySetterDescriptorImpl(
correspondingProperty: PropertyDescriptor correspondingProperty: PropertyDescriptor,
override val kind: IrSyntheticPropertyAccessorDescriptor.Kind
) : PropertySetterDescriptorImpl( ) : PropertySetterDescriptorImpl(
correspondingProperty, correspondingProperty,
Annotations.EMPTY, Annotations.EMPTY,
@@ -63,7 +71,7 @@ class IrSyntheticStaticPropertySetterDescriptorImpl(
CallableMemberDescriptor.Kind.SYNTHESIZED, CallableMemberDescriptor.Kind.SYNTHESIZED,
null, null,
correspondingProperty.source correspondingProperty.source
), IrSyntheticStaticPropertySetterDescriptor { ), IrSyntheticPropertySetterDescriptor {
init { init {
initializeDefault() initializeDefault()
} }