FIR general refactoring: get rid of ConeSymbols
This commit is contained in:
-11
@@ -5,7 +5,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.fir.symbols
|
||||
|
||||
import org.jetbrains.kotlin.fir.types.ConeKotlinType
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
@@ -33,14 +32,4 @@ data class CallableId(val packageName: FqName, val className: FqName?, val calla
|
||||
}
|
||||
}
|
||||
|
||||
interface ConeCallableSymbol : ConeSymbol {
|
||||
val callableId: CallableId
|
||||
}
|
||||
|
||||
interface ConePropertySymbol : ConeVariableSymbol
|
||||
|
||||
interface ConeVariableSymbol : ConeCallableSymbol
|
||||
|
||||
interface ConeFunctionSymbol : ConeCallableSymbol {
|
||||
val parameters: List<ConeKotlinType>
|
||||
}
|
||||
@@ -12,16 +12,7 @@ abstract class ConeClassifierLookupTag {
|
||||
abstract val name: Name
|
||||
}
|
||||
|
||||
abstract class ConeClassifierLookupTagWithFixedSymbol : ConeClassifierLookupTag() {
|
||||
abstract val symbol: ConeClassifierSymbol
|
||||
}
|
||||
|
||||
data class ConeTypeParameterLookupTag(val typeParameterSymbol: ConeTypeParameterSymbol) : ConeClassifierLookupTagWithFixedSymbol() {
|
||||
override val name: Name get() = typeParameterSymbol.name
|
||||
override val symbol: ConeClassifierSymbol
|
||||
get() = typeParameterSymbol
|
||||
|
||||
}
|
||||
|
||||
abstract class ConeClassLikeLookupTag : ConeClassifierLookupTag() {
|
||||
abstract val classId: ClassId
|
||||
@@ -32,23 +23,3 @@ abstract class ConeClassLikeLookupTag : ConeClassifierLookupTag() {
|
||||
|
||||
abstract class ConeTypeAliasLookupTag : ConeClassLikeLookupTag()
|
||||
|
||||
abstract class ConeClassLookupTag : ConeClassLikeLookupTag()
|
||||
|
||||
class ConeClassLikeLookupTagImpl(override val classId: ClassId) : ConeClassLikeLookupTag() {
|
||||
var boundSymbol: Pair<*, ConeClassifierSymbol?>? = null
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as ConeClassLikeLookupTagImpl
|
||||
|
||||
if (classId != other.classId) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
return classId.hashCode()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.ClassId
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.types.model.TypeConstructorMarker
|
||||
import org.jetbrains.kotlin.types.model.TypeParameterMarker
|
||||
|
||||
interface ConeSymbol : TypeConstructorMarker
|
||||
|
||||
interface ConeClassifierSymbol : ConeSymbol, TypeParameterMarker {
|
||||
fun toLookupTag(): ConeClassifierLookupTag
|
||||
}
|
||||
|
||||
interface ConeTypeParameterSymbol : ConeClassifierSymbol {
|
||||
override fun toLookupTag(): ConeTypeParameterLookupTag = ConeTypeParameterLookupTag(this)
|
||||
val name: Name
|
||||
}
|
||||
|
||||
interface ConeClassLikeSymbol : ConeClassifierSymbol, TypeConstructorMarker {
|
||||
val classId: ClassId
|
||||
|
||||
override fun toLookupTag(): ConeClassLikeLookupTag
|
||||
}
|
||||
|
||||
interface ConeTypeAliasSymbol : ConeClassLikeSymbol
|
||||
|
||||
interface ConeClassSymbol : ConeClassLikeSymbol
|
||||
@@ -86,9 +86,11 @@ val ConeKotlinType.isMarkedNullable: Boolean get() = nullability == ConeNullabil
|
||||
|
||||
typealias ConeKotlinErrorType = ConeClassErrorType
|
||||
|
||||
class ConeClassLikeErrorLookupTag(override val classId: ClassId) : ConeClassLikeLookupTag()
|
||||
|
||||
class ConeClassErrorType(val reason: String) : ConeClassLikeType() {
|
||||
override val lookupTag: ConeClassLikeLookupTag
|
||||
get() = ConeClassLikeLookupTagImpl(ClassId.fromString("<error>"))
|
||||
get() = ConeClassLikeErrorLookupTag(ClassId.fromString("<error>"))
|
||||
|
||||
override val typeArguments: Array<out ConeKotlinTypeProjection>
|
||||
get() = EMPTY_ARRAY
|
||||
@@ -101,7 +103,7 @@ class ConeClassErrorType(val reason: String) : ConeClassLikeType() {
|
||||
}
|
||||
}
|
||||
|
||||
sealed class ConeLookupTagBasedType : ConeKotlinType(), SimpleTypeMarker {
|
||||
abstract class ConeLookupTagBasedType : ConeKotlinType(), SimpleTypeMarker {
|
||||
abstract val lookupTag: ConeClassifierLookupTag
|
||||
}
|
||||
|
||||
@@ -115,10 +117,6 @@ abstract class ConeAbbreviatedType : ConeClassLikeType() {
|
||||
abstract val abbreviationLookupTag: ConeClassLikeLookupTag
|
||||
}
|
||||
|
||||
abstract class ConeTypeParameterType : ConeLookupTagBasedType() {
|
||||
abstract override val lookupTag: ConeTypeParameterLookupTag
|
||||
}
|
||||
|
||||
data class ConeFlexibleType(val lowerBound: ConeKotlinType, val upperBound: ConeKotlinType) : ConeKotlinType(),
|
||||
FlexibleTypeMarker {
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ fun ConeKotlinType.render(): String {
|
||||
}
|
||||
}
|
||||
}
|
||||
is ConeTypeParameterType -> {
|
||||
is ConeLookupTagBasedType -> {
|
||||
lookupTag.name.asString()
|
||||
}
|
||||
is ConeFlexibleType -> {
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
package org.jetbrains.kotlin.fir.types.impl
|
||||
|
||||
import org.jetbrains.kotlin.fir.symbols.ConeClassLikeLookupTag
|
||||
import org.jetbrains.kotlin.fir.symbols.ConeTypeParameterLookupTag
|
||||
import org.jetbrains.kotlin.fir.types.*
|
||||
|
||||
open class ConeClassTypeImpl(
|
||||
@@ -49,32 +48,3 @@ class ConeAbbreviatedTypeImpl(
|
||||
override val nullability: ConeNullability = ConeNullability.create(isNullable)
|
||||
}
|
||||
|
||||
class ConeTypeParameterTypeImpl(
|
||||
override val lookupTag: ConeTypeParameterLookupTag,
|
||||
isNullable: Boolean
|
||||
) : ConeTypeParameterType() {
|
||||
override val typeArguments: Array<out ConeKotlinTypeProjection>
|
||||
get() = EMPTY_ARRAY
|
||||
|
||||
override val nullability: ConeNullability = ConeNullability.create(isNullable)
|
||||
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as ConeTypeParameterTypeImpl
|
||||
|
||||
if (lookupTag != other.lookupTag) return false
|
||||
if (nullability != other.nullability) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = lookupTag.hashCode()
|
||||
result = 31 * result + nullability.hashCode()
|
||||
return result
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user