[FIR IDE] Add fir data into symbols to support FIR LC
This commit is contained in:
committed by
Ilya Kirillov
parent
3d93503894
commit
b423da106f
+7
-6
@@ -5,9 +5,9 @@
|
||||
|
||||
package org.jetbrains.kotlin.fir.backend.jvm
|
||||
|
||||
import org.jetbrains.kotlin.codegen.signature.JvmSignatureWriter
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||
import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.FirSessionComponent
|
||||
import org.jetbrains.kotlin.fir.*
|
||||
import org.jetbrains.kotlin.fir.resolve.defaultType
|
||||
import org.jetbrains.kotlin.fir.resolve.firSymbolProvider
|
||||
import org.jetbrains.kotlin.fir.resolve.inference.isKClassType
|
||||
@@ -17,11 +17,11 @@ import org.jetbrains.kotlin.fir.symbols.ConeClassifierLookupTag
|
||||
import org.jetbrains.kotlin.fir.symbols.ConeTypeParameterLookupTag
|
||||
import org.jetbrains.kotlin.fir.symbols.StandardClassIds
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol
|
||||
import org.jetbrains.kotlin.fir.typeContext
|
||||
import org.jetbrains.kotlin.fir.types.*
|
||||
import org.jetbrains.kotlin.fir.types.impl.ConeTypeParameterTypeImpl
|
||||
import org.jetbrains.kotlin.load.kotlin.JvmDescriptorTypeWriter
|
||||
import org.jetbrains.kotlin.load.kotlin.TypeMappingMode
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.types.AbstractTypeMapper
|
||||
import org.jetbrains.kotlin.types.TypeMappingContext
|
||||
import org.jetbrains.kotlin.types.TypeSystemCommonBackendContext
|
||||
@@ -35,8 +35,8 @@ import org.jetbrains.org.objectweb.asm.Type
|
||||
class FirJvmTypeMapper(val session: FirSession) : TypeMappingContext<JvmDescriptorTypeWriter<Type>>, FirSessionComponent {
|
||||
override val typeContext = ConeTypeSystemCommonBackendContextForTypeMapping(session.typeContext)
|
||||
|
||||
fun mapType(type: ConeKotlinType, mode: TypeMappingMode = TypeMappingMode.DEFAULT): Type {
|
||||
return AbstractTypeMapper.mapType(this, type, mode)
|
||||
fun mapType(type: ConeKotlinType, mode: TypeMappingMode = TypeMappingMode.DEFAULT, sw: JvmDescriptorTypeWriter<Type>? = null): Type {
|
||||
return AbstractTypeMapper.mapType(this, type, mode, sw)
|
||||
}
|
||||
|
||||
override fun getClassInternalName(typeConstructor: TypeConstructorMarker): String {
|
||||
@@ -45,7 +45,8 @@ class FirJvmTypeMapper(val session: FirSession) : TypeMappingContext<JvmDescript
|
||||
}
|
||||
|
||||
override fun JvmDescriptorTypeWriter<Type>.writeGenericType(type: SimpleTypeMarker, asmType: Type, mode: TypeMappingMode) {
|
||||
error("Should not be called")
|
||||
//TODO Make correct implementation
|
||||
(this as JvmSignatureWriter).writeAsmType(asmType)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,10 @@ fun ConeClassLikeType.isLong(): Boolean = lookupTag.classId == StandardClassIds.
|
||||
fun ConeClassLikeType.isInt(): Boolean = lookupTag.classId == StandardClassIds.Int
|
||||
fun ConeClassLikeType.isShort(): Boolean = lookupTag.classId == StandardClassIds.Short
|
||||
fun ConeClassLikeType.isByte(): Boolean = lookupTag.classId == StandardClassIds.Byte
|
||||
fun ConeClassLikeType.isBoolean(): Boolean = lookupTag.classId == StandardClassIds.Boolean
|
||||
fun ConeClassLikeType.isChar(): Boolean = lookupTag.classId == StandardClassIds.Char
|
||||
|
||||
fun ConeClassLikeType.isPrimitiveType(): Boolean = isPrimitiveNumberOrUnsignedNumberType() || isBoolean() || isByte() || isShort()
|
||||
fun ConeClassLikeType.isPrimitiveNumberType(): Boolean = lookupTag.classId in PRIMITIVE_NUMBER_CLASS_IDS
|
||||
fun ConeClassLikeType.isPrimitiveUnsignedNumberType(): Boolean = lookupTag.classId in PRIMITIVE_UNSIGNED_NUMBER_CLASS_IDS
|
||||
fun ConeClassLikeType.isPrimitiveNumberOrUnsignedNumberType(): Boolean = isPrimitiveNumberType() || isPrimitiveUnsignedNumberType()
|
||||
|
||||
Reference in New Issue
Block a user