org.jetbrains.kotlin.fir.declarations.synthetic.FirSyntheticProperty.kt Maven / Gradle / Ivy
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.fir.declarations.synthetic
import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.FirSourceElement
import org.jetbrains.kotlin.fir.declarations.*
import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall
import org.jetbrains.kotlin.fir.expressions.FirExpression
import org.jetbrains.kotlin.fir.references.FirControlFlowGraphReference
import org.jetbrains.kotlin.fir.symbols.impl.FirAccessorSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirBackingFieldSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirDelegateFieldSymbol
import org.jetbrains.kotlin.fir.types.ConeKotlinType
import org.jetbrains.kotlin.fir.types.FirTypeRef
import org.jetbrains.kotlin.fir.visitors.FirTransformer
import org.jetbrains.kotlin.fir.visitors.FirVisitor
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
class FirSyntheticProperty(
override val session: FirSession,
override val name: Name,
override val isVar: Boolean,
override val symbol: FirAccessorSymbol,
override val status: FirDeclarationStatus,
override var resolvePhase: FirResolvePhase,
override val getter: FirSyntheticPropertyAccessor,
override val setter: FirSyntheticPropertyAccessor? = null
) : FirProperty() {
init {
symbol.bind(this)
}
override val returnTypeRef: FirTypeRef
get() = getter.returnTypeRef
override val dispatchReceiverType: ConeKotlinType?
get() = getter.dispatchReceiverType
override val source: FirSourceElement?
get() = null
override val origin: FirDeclarationOrigin
get() = FirDeclarationOrigin.Synthetic
override val initializer: FirExpression?
get() = null
override val delegate: FirExpression?
get() = null
override val delegateFieldSymbol: FirDelegateFieldSymbol?
get() = null
override val isLocal: Boolean
get() = false
override val receiverTypeRef: FirTypeRef?
get() = null
override val isVal: Boolean
get() = !isVar
override val annotations: List
get() = emptyList()
override val typeParameters: List
get() = emptyList()
override val containerSource: DeserializedContainerSource?
get() = null
override val controlFlowGraphReference: FirControlFlowGraphReference? = null
override val attributes: FirDeclarationAttributes = FirDeclarationAttributes()
// ???
override val backingFieldSymbol: FirBackingFieldSymbol = FirBackingFieldSymbol(symbol.callableId)
override fun acceptChildren(visitor: FirVisitor, data: D) {
returnTypeRef.accept(visitor, data)
status.accept(visitor, data)
}
override fun transformChildren(transformer: FirTransformer, data: D): FirSyntheticProperty {
throw AssertionError("Transformation of synthetic property isn't supported")
}
override fun transformReturnTypeRef(transformer: FirTransformer, data: D): FirSyntheticProperty {
throw AssertionError("Transformation of synthetic property isn't supported")
}
override fun transformReceiverTypeRef(transformer: FirTransformer, data: D): FirSyntheticProperty {
throw AssertionError("Transformation of synthetic property isn't supported")
}
override fun transformStatus(transformer: FirTransformer, data: D): FirSyntheticProperty {
throw AssertionError("Transformation of synthetic property isn't supported")
}
override fun transformOtherChildren(transformer: FirTransformer, data: D): FirSyntheticProperty {
throw AssertionError("Transformation of synthetic property isn't supported")
}
override fun transformInitializer(transformer: FirTransformer, data: D): FirSyntheticProperty {
throw AssertionError("Transformation of synthetic property isn't supported")
}
override fun transformGetter(transformer: FirTransformer, data: D): FirSyntheticProperty {
throw AssertionError("Transformation of synthetic property isn't supported")
}
override fun transformSetter(transformer: FirTransformer, data: D): FirSyntheticProperty {
throw AssertionError("Transformation of synthetic property isn't supported")
}
override fun transformDelegate(transformer: FirTransformer, data: D): FirProperty {
throw AssertionError("Transformation of synthetic property isn't supported")
}
override fun transformAnnotations(transformer: FirTransformer, data: D): FirSyntheticProperty {
throw AssertionError("Transformation of synthetic property isn't supported")
}
override fun transformTypeParameters(transformer: FirTransformer, data: D): FirProperty {
throw AssertionError("Transformation of synthetic property isn't supported")
}
override fun replaceResolvePhase(newResolvePhase: FirResolvePhase) {
resolvePhase = newResolvePhase
}
override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef) {
throw AssertionError("Mutation of synthetic property isn't supported")
}
override fun replaceReceiverTypeRef(newReceiverTypeRef: FirTypeRef?) {
throw AssertionError("Mutation of synthetic property isn't supported")
}
override fun replaceControlFlowGraphReference(newControlFlowGraphReference: FirControlFlowGraphReference?) {
throw AssertionError("Mutation of synthetic property isn't supported")
}
override fun replaceInitializer(newInitializer: FirExpression?) {
throw AssertionError("Mutation of synthetic property isn't supported")
}
}