FIR: Introduce new classifier descriptors aka 'cones'

This commit is contained in:
Simon Ogorodnik
2018-03-20 01:23:31 +03:00
committed by Mikhail Glukhikh
parent ce7456c93d
commit 7e95eee9f1
4 changed files with 73 additions and 0 deletions
@@ -0,0 +1,31 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. 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.descriptors
import org.jetbrains.kotlin.fir.UnambiguousFqName
import org.jetbrains.kotlin.fir.types.ConeKotlinType
interface ConeDescriptor
interface ConeClassifierDescriptor : ConeDescriptor
interface ConeClassifierDescriptorWithTypeParameters : ConeClassifierDescriptor {
val typeParameters: List<ConeTypeParameterDescriptor>
val fqName: UnambiguousFqName
}
interface ConeTypeParameterDescriptor : ConeClassifierDescriptor
interface ConeTypeAliasDescriptor : ConeClassifierDescriptorWithTypeParameters {
val expandedType: ConeKotlinType
}
interface ConeClassDescriptor : ConeClassifierDescriptorWithTypeParameters {
val superTypes: List<ConeKotlinType>
val nestedClassifiers: List<ConeClassifierDescriptor>
}
@@ -0,0 +1,19 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. 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.descriptors
import org.jetbrains.kotlin.fir.FirBasedDescriptor
import org.jetbrains.kotlin.fir.FirDescriptorOwner
import org.jetbrains.kotlin.fir.FirElement
abstract class AbstractFirBasedDescriptor<E> : FirBasedDescriptor<E> where E : FirElement, E : FirDescriptorOwner<E> {
override lateinit var fir: E
override fun bind(e: E) {
fir = e
}
}
@@ -0,0 +1,13 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. 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
import org.jetbrains.kotlin.fir.descriptors.ConeDescriptor
interface FirBasedDescriptor<E> : ConeDescriptor where E : FirElement, E : FirDescriptorOwner<E> {
val fir: E
fun bind(e: E)
}
@@ -0,0 +1,10 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. 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
interface FirDescriptorOwner<TElem> where TElem : FirElement, TElem : FirDescriptorOwner<TElem> {
val descriptor: FirBasedDescriptor<TElem>
}