FIR: get rid of library type parameter symbol

This commit is contained in:
Mikhail Glukhikh
2019-04-19 19:37:01 +03:00
parent 649c2f6bcc
commit 4a5b900d28
3 changed files with 0 additions and 42 deletions
@@ -8,7 +8,6 @@ package org.jetbrains.kotlin.fir.backend
import org.jetbrains.kotlin.fir.*
import org.jetbrains.kotlin.fir.resolve.toSymbol
import org.jetbrains.kotlin.fir.symbols.ConeClassifierSymbol
import org.jetbrains.kotlin.fir.symbols.LibraryTypeParameterSymbol
import org.jetbrains.kotlin.fir.symbols.impl.*
import org.jetbrains.kotlin.fir.types.*
import org.jetbrains.kotlin.ir.IrElement
@@ -82,9 +81,6 @@ fun ConeClassifierSymbol.toIrSymbol(session: FirSession, declarationStorage: Fir
is FirTypeParameterSymbol -> {
toTypeParameterSymbol(declarationStorage)
}
is LibraryTypeParameterSymbol -> {
toTypeParameterSymbol(declarationStorage)
}
is FirTypeAliasSymbol -> {
val typeAlias = fir
val coneClassLikeType = (typeAlias.expandedTypeRef as FirResolvedTypeRef).type as ConeClassLikeType
@@ -123,10 +119,6 @@ fun FirTypeParameterSymbol.toTypeParameterSymbol(declarationStorage: Fir2IrDecla
return declarationStorage.getIrTypeParameterSymbol(this)
}
fun LibraryTypeParameterSymbol.toTypeParameterSymbol(declarationStorage: Fir2IrDeclarationStorage): IrTypeParameterSymbol {
return declarationStorage.getIrTypeParameterSymbol(this)
}
fun FirFunctionSymbol.toFunctionSymbol(declarationStorage: Fir2IrDeclarationStorage): IrFunctionSymbol {
return declarationStorage.getIrFunctionSymbol(this)
}
@@ -17,7 +17,6 @@ import org.jetbrains.kotlin.fir.expressions.FirVariable
import org.jetbrains.kotlin.fir.render
import org.jetbrains.kotlin.fir.resolve.FirSymbolProvider
import org.jetbrains.kotlin.fir.service
import org.jetbrains.kotlin.fir.symbols.LibraryTypeParameterSymbol
import org.jetbrains.kotlin.fir.symbols.impl.*
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.declarations.impl.*
@@ -29,7 +28,6 @@ import org.jetbrains.kotlin.ir.util.SymbolTable
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.psi.KtFunctionLiteral
import org.jetbrains.kotlin.types.Variance
class Fir2IrDeclarationStorage(
private val session: FirSession,
@@ -44,8 +42,6 @@ class Fir2IrDeclarationStorage(
private val typeParameterCache = mutableMapOf<FirTypeParameter, IrTypeParameter>()
private val libraryTypeParameterCache = mutableMapOf<LibraryTypeParameterSymbol, IrTypeParameter>()
private val functionCache = mutableMapOf<FirNamedFunction, IrSimpleFunction>()
private val constructorCache = mutableMapOf<FirConstructor, IrConstructor>()
@@ -414,24 +410,6 @@ class Fir2IrDeclarationStorage(
return irSymbolTable.referenceTypeParameter(irTypeParameter.descriptor)
}
fun getIrTypeParameterSymbol(typeParameterSymbol: LibraryTypeParameterSymbol): IrTypeParameterSymbol {
val irTypeParameter = libraryTypeParameterCache.getOrPut(typeParameterSymbol) {
val descriptor = WrappedTypeParameterDescriptor()
val origin = IrDeclarationOrigin.DEFINED
irSymbolTable.declareGlobalTypeParameter(-1, -1, origin, descriptor) { symbol ->
IrTypeParameterImpl(
-1, -1, origin, symbol,
typeParameterSymbol.name, -1,
false,
Variance.INVARIANT
).apply {
descriptor.bind(this)
}
}
}
return irSymbolTable.referenceTypeParameter(irTypeParameter.descriptor)
}
fun getIrFunctionSymbol(firFunctionSymbol: FirFunctionSymbol): IrFunctionSymbol {
return when (val firDeclaration = firFunctionSymbol.fir) {
is FirNamedFunction -> {
@@ -1,12 +0,0 @@
/*
* 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.symbols
import org.jetbrains.kotlin.name.Name
class LibraryTypeParameterSymbol(override val name: Name) : ConeTypeParameterSymbol {
}