FIR: Use lookup tags for as type constructors instead of symbols

It may help to avoid redundant symbols lookups
This commit is contained in:
Denis Zharkov
2020-08-20 13:04:06 +03:00
parent 34b55dbeb3
commit 9ac5dd2bce
12 changed files with 116 additions and 109 deletions
@@ -5,13 +5,15 @@
package org.jetbrains.kotlin.fir.symbols
import org.jetbrains.kotlin.fir.symbols.impl.FirClassifierSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirTypeParameterSymbol
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.types.model.TypeParameterMarker
data class ConeTypeParameterLookupTag(val typeParameterSymbol: FirTypeParameterSymbol) : ConeClassifierLookupTagWithFixedSymbol() {
data class ConeTypeParameterLookupTag(
val typeParameterSymbol: FirTypeParameterSymbol
) : ConeClassifierLookupTagWithFixedSymbol(), TypeParameterMarker {
override val name: Name get() = typeParameterSymbol.name
override val symbol: FirClassifierSymbol<*>
override val symbol: FirTypeParameterSymbol
get() = typeParameterSymbol
}
@@ -7,10 +7,9 @@ package org.jetbrains.kotlin.fir.symbols
import org.jetbrains.kotlin.fir.FirSymbolOwner
import org.jetbrains.kotlin.fir.declarations.FirDeclaration
import org.jetbrains.kotlin.types.model.TypeConstructorMarker
interface FirBasedSymbol<E> : TypeConstructorMarker where E : FirSymbolOwner<E>, E : FirDeclaration {
interface FirBasedSymbol<E> where E : FirSymbolOwner<E>, E : FirDeclaration {
val fir: E
fun bind(e: E)
}
}
@@ -9,9 +9,8 @@ import org.jetbrains.kotlin.fir.FirSymbolOwner
import org.jetbrains.kotlin.fir.declarations.FirDeclaration
import org.jetbrains.kotlin.fir.symbols.AbstractFirBasedSymbol
import org.jetbrains.kotlin.fir.symbols.ConeClassifierLookupTag
import org.jetbrains.kotlin.types.model.TypeParameterMarker
abstract class FirClassifierSymbol<E> : AbstractFirBasedSymbol<E>(), TypeParameterMarker
abstract class FirClassifierSymbol<E> : AbstractFirBasedSymbol<E>()
where E : FirSymbolOwner<E>, E : FirDeclaration {
abstract fun toLookupTag(): ConeClassifierLookupTag
}
}