IR: mark interface delegate fields as synthetic

This requires separating them origin-wise from property delegates.
This commit is contained in:
pyos
2020-01-20 14:26:46 +01:00
committed by Dmitry Petrov
parent ce1f746c5e
commit f1669e2230
31 changed files with 125 additions and 124 deletions
@@ -36,7 +36,7 @@ class AnnotationGenerator(context: GeneratorContext) : IrElementVisitorVoid {
// Delegate field is mapped to a new property descriptor with annotations of the original property delegate
// (see IrPropertyDelegateDescriptorImpl), but annotations on backing fields should be processed manually here
val annotatedDescriptor =
if (declaration is IrField && declaration.origin != IrDeclarationOrigin.DELEGATE)
if (declaration is IrField && declaration.origin != IrDeclarationOrigin.PROPERTY_DELEGATE)
declaration.descriptor.backingField
else declaration.descriptor
@@ -125,7 +125,7 @@ class DelegatedPropertyGenerator(declarationGenerator: DeclarationGenerator) : D
val startOffset = ktDelegate.startOffsetSkippingComments
val endOffset = ktDelegate.endOffset
val origin = IrDeclarationOrigin.DELEGATE
val origin = IrDeclarationOrigin.PROPERTY_DELEGATE
val type = delegateDescriptor.type.toIrType()
return context.symbolTable.declareField(
startOffset, endOffset, origin, delegateDescriptor, type
@@ -287,7 +287,7 @@ class DelegatedPropertyGenerator(declarationGenerator: DeclarationGenerator) : D
val delegateDescriptor = createLocalPropertyDelegatedDescriptor(variableDescriptor, delegateType, kPropertyType)
return context.symbolTable.declareVariable(
ktDelegate.startOffsetSkippingComments, ktDelegate.endOffset, IrDeclarationOrigin.DELEGATE,
ktDelegate.startOffsetSkippingComments, ktDelegate.endOffset, IrDeclarationOrigin.PROPERTY_DELEGATE,
delegateDescriptor, delegateDescriptor.type.toIrType()
).also { irVariable ->
irVariable.initializer = generateInitializerForLocalDelegatedPropertyDelegate(