[FIR] Add deserialization of contracts
This commit is contained in:
@@ -17,9 +17,16 @@ val FirTypeRef.isNullableAny: Boolean get() = isBuiltinType(StandardClassIds.Any
|
||||
val FirTypeRef.isNothing: Boolean get() = isBuiltinType(StandardClassIds.Nothing, false)
|
||||
val FirTypeRef.isNullableNothing: Boolean get() = isBuiltinType(StandardClassIds.Nothing, true)
|
||||
val FirTypeRef.isUnit: Boolean get() = isBuiltinType(StandardClassIds.Unit, false)
|
||||
val FirTypeRef.isBoolean: Boolean get() = isBuiltinType(StandardClassIds.Boolean, false)
|
||||
|
||||
private fun FirTypeRef.isBuiltinType(classId: ClassId, isNullable: Boolean): Boolean =
|
||||
this is FirImplicitBuiltinTypeRef && type.lookupTag.classId == classId && type.isNullable == isNullable
|
||||
private fun FirTypeRef.isBuiltinType(classId: ClassId, isNullable: Boolean): Boolean {
|
||||
val type = when (this) {
|
||||
is FirImplicitBuiltinTypeRef -> type
|
||||
is FirResolvedTypeRef -> type as? ConeClassLikeType ?: return false
|
||||
else -> return false
|
||||
}
|
||||
return type.lookupTag.classId == classId && type.isNullable == isNullable
|
||||
}
|
||||
|
||||
val FirFunctionTypeRef.parametersCount: Int
|
||||
get() = if (receiverTypeRef != null)
|
||||
|
||||
Reference in New Issue
Block a user