Get rid of name in FirConstructor
This commit is contained in:
+1
-1
@@ -509,7 +509,7 @@ class Fir2IrDeclarationStorage(
|
||||
irSymbolTable.declareConstructor(startOffset, endOffset, origin, descriptor) { symbol ->
|
||||
IrConstructorImpl(
|
||||
startOffset, endOffset, origin, symbol,
|
||||
constructor.name, visibility,
|
||||
Name.special("<init>"), visibility,
|
||||
constructor.returnTypeRef.toIrType(session, this),
|
||||
isInline = false, isExternal = false, isPrimary = isPrimary, isExpect = false
|
||||
).bindAndDeclareParameters(constructor, descriptor, irParent, isStatic = true, shouldLeaveScope = shouldLeaveScope)
|
||||
|
||||
@@ -183,8 +183,9 @@ class Fir2IrVisitor(
|
||||
is FirClassSymbol -> {
|
||||
val superClass = superSymbol.fir as FirClass<*>
|
||||
for (declaration in superClass.declarations) {
|
||||
if (declaration is FirMemberDeclaration && (declaration is FirSimpleFunction || declaration is FirProperty)) {
|
||||
result += declaration.name
|
||||
when (declaration) {
|
||||
is FirSimpleFunction -> result += declaration.name
|
||||
is FirVariable<*> -> result += declaration.name
|
||||
}
|
||||
}
|
||||
superClass.collectCallableNamesFromSupertypes(result)
|
||||
@@ -288,8 +289,9 @@ class Fir2IrVisitor(
|
||||
if (it !is FirConstructor || !it.isPrimary) {
|
||||
val irDeclaration = it.toIrDeclaration() ?: return@forEach
|
||||
declarations += irDeclaration
|
||||
if (it is FirMemberDeclaration && (it is FirSimpleFunction || it is FirProperty)) {
|
||||
processedCallableNames += it.name
|
||||
when (it) {
|
||||
is FirSimpleFunction -> processedCallableNames += it.name
|
||||
is FirProperty -> processedCallableNames += it.name
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -439,7 +441,8 @@ class Fir2IrVisitor(
|
||||
classId.shortClassName
|
||||
) {
|
||||
when {
|
||||
it !is FirConstructorSymbol -> {}
|
||||
it !is FirConstructorSymbol -> {
|
||||
}
|
||||
arguments.size <= it.fir.valueParameters.size && constructorSymbol == null -> {
|
||||
constructorSymbol = it
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ class FirJavaConstructor(
|
||||
) : FirPureAbstractElement(), FirAbstractAnnotatedElement, FirConstructor {
|
||||
override val receiverTypeRef: FirTypeRef? get() = null
|
||||
override val typeParameters: MutableList<FirTypeParameter> = mutableListOf()
|
||||
override val name: Name get() = CONSTRUCTOR_NAME
|
||||
override val annotations: MutableList<FirAnnotationCall> = mutableListOf()
|
||||
|
||||
override var status: FirDeclarationStatus = FirDeclarationStatusImpl(visibility, Modality.FINAL).apply {
|
||||
|
||||
@@ -30,7 +30,6 @@ class FirJavaMethod(
|
||||
session,
|
||||
returnTypeRef,
|
||||
null,
|
||||
name,
|
||||
FirDeclarationStatusImpl(visibility, modality).apply {
|
||||
this.isStatic = isStatic
|
||||
isExpect = false
|
||||
@@ -43,6 +42,7 @@ class FirJavaMethod(
|
||||
isExternal = false
|
||||
isSuspend = false
|
||||
},
|
||||
name,
|
||||
symbol
|
||||
) {
|
||||
init {
|
||||
|
||||
+10
-19
@@ -127,11 +127,6 @@ class KotlinDeserializedJvmSymbolsProvider(
|
||||
}
|
||||
}
|
||||
|
||||
private fun readData(kotlinClass: KotlinJvmBinaryClass, expectedKinds: Set<KotlinClassHeader.Kind>): Array<String>? {
|
||||
val header = kotlinClass.classHeader
|
||||
return (header.data ?: header.incompatibleData)?.takeIf { header.kind in expectedKinds }
|
||||
}
|
||||
|
||||
private val KotlinJvmBinaryClass.incompatibility: IncompatibleVersionErrorData<JvmMetadataVersion>?
|
||||
get() {
|
||||
// TODO: skipMetadataVersionCheck
|
||||
@@ -202,9 +197,6 @@ class KotlinDeserializedJvmSymbolsProvider(
|
||||
|
||||
private fun ClassId.toEnumEntryReferenceExpression(name: Name): FirExpression {
|
||||
return FirFunctionCallImpl(null).apply {
|
||||
val entryClassId = createNestedClassId(name)
|
||||
val entryLookupTag = ConeClassLikeLookupTagImpl(entryClassId)
|
||||
val entryClassSymbol = entryLookupTag.toSymbol(this@KotlinDeserializedJvmSymbolsProvider.session)
|
||||
val entryCallableSymbol =
|
||||
this@KotlinDeserializedJvmSymbolsProvider.session.firSymbolProvider.getClassDeclaredCallableSymbols(
|
||||
this@toEnumEntryReferenceExpression, name
|
||||
@@ -219,7 +211,9 @@ class KotlinDeserializedJvmSymbolsProvider(
|
||||
else -> {
|
||||
FirErrorNamedReferenceImpl(
|
||||
null,
|
||||
FirSimpleDiagnostic("Strange deserialized enum value: ${this@toEnumEntryReferenceExpression}.$name", DiagnosticKind.Java)
|
||||
FirSimpleDiagnostic(
|
||||
"Strange deserialized enum value: ${this@toEnumEntryReferenceExpression}.$name", DiagnosticKind.Java
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -416,20 +410,17 @@ class KotlinDeserializedJvmSymbolsProvider(
|
||||
getClassLikeSymbolByFqName(classId)?.fir as? FirRegularClass
|
||||
|
||||
override fun getAllCallableNamesInClass(classId: ClassId): Set<Name> =
|
||||
getClassDeclarations(classId)
|
||||
.filterIsInstance<FirMemberDeclaration>()
|
||||
.mapTo(mutableSetOf(), FirMemberDeclaration::name)
|
||||
getClassDeclarations(classId).mapNotNullTo(mutableSetOf()) {
|
||||
when (it) {
|
||||
is FirSimpleFunction -> it.name
|
||||
is FirVariable<*> -> it.name
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
override fun getNestedClassesNamesInClass(classId: ClassId): Set<Name> {
|
||||
return getClassDeclarations(classId).filterIsInstance<FirRegularClass>().mapTo(mutableSetOf()) { it.name }
|
||||
}
|
||||
|
||||
override fun getPackage(fqName: FqName): FqName? = null
|
||||
|
||||
companion object {
|
||||
private val KOTLIN_CLASS = setOf(KotlinClassHeader.Kind.CLASS)
|
||||
|
||||
private val KOTLIN_FILE_FACADE_OR_MULTIFILE_CLASS_PART =
|
||||
setOf(KotlinClassHeader.Kind.FILE_FACADE, KotlinClassHeader.Kind.MULTIFILE_CLASS_PART)
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -222,8 +222,8 @@ class JavaClassEnhancementScope(
|
||||
this@JavaClassEnhancementScope.session,
|
||||
newReturnTypeRef,
|
||||
newReceiverTypeRef,
|
||||
name,
|
||||
firMethod.status,
|
||||
name,
|
||||
if (!isAccessor) FirNamedFunctionSymbol(methodId)
|
||||
else FirAccessorSymbol(callableId = propertyId!!, accessorId = methodId)
|
||||
).apply {
|
||||
@@ -303,7 +303,7 @@ class JavaClassEnhancementScope(
|
||||
|
||||
private val overrideBindCache = mutableMapOf<Name, Map<FirCallableSymbol<*>?, List<FirCallableSymbol<*>>>>()
|
||||
|
||||
private fun FirCallableMemberDeclaration<*>.overriddenMembers(): List<FirCallableMemberDeclaration<*>> {
|
||||
private fun FirSimpleFunction.overriddenMembers(): List<FirCallableMemberDeclaration<*>> {
|
||||
val backMap = overrideBindCache.getOrPut(this.name) {
|
||||
useSiteMemberScope.bindOverrides(this.name)
|
||||
useSiteMemberScope
|
||||
|
||||
+4
-4
@@ -371,20 +371,20 @@ class DeclarationsConverter(
|
||||
FirSealedClassImpl(
|
||||
null,
|
||||
session,
|
||||
className,
|
||||
status,
|
||||
classKind,
|
||||
scopeProvider,
|
||||
className,
|
||||
FirRegularClassSymbol(context.currentClassId)
|
||||
)
|
||||
} else {
|
||||
FirClassImpl(
|
||||
null,
|
||||
session,
|
||||
className,
|
||||
status,
|
||||
classKind,
|
||||
scopeProvider,
|
||||
className,
|
||||
FirRegularClassSymbol(context.currentClassId)
|
||||
)
|
||||
}
|
||||
@@ -795,8 +795,8 @@ class DeclarationsConverter(
|
||||
return@withChildClassName FirTypeAliasImpl(
|
||||
null,
|
||||
session,
|
||||
typeAliasName,
|
||||
status,
|
||||
typeAliasName,
|
||||
FirTypeAliasSymbol(context.currentClassId),
|
||||
firType
|
||||
).apply {
|
||||
@@ -1112,8 +1112,8 @@ class DeclarationsConverter(
|
||||
session,
|
||||
returnType!!,
|
||||
receiverType,
|
||||
functionName,
|
||||
status,
|
||||
functionName,
|
||||
FirNamedFunctionSymbol(callableIdForName(functionName, isLocal))
|
||||
)
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ fun List<Pair<KtParameter?, FirProperty>>.generateComponentFunctions(
|
||||
firClass.addDeclaration(
|
||||
FirSimpleFunctionImpl(
|
||||
parameterSource, session, FirImplicitTypeRefImpl(parameterSource),
|
||||
null, name, status, symbol
|
||||
null, status, name, symbol
|
||||
).apply {
|
||||
val componentFunction = this
|
||||
body = FirSingleExpressionBlock(
|
||||
@@ -84,8 +84,8 @@ fun List<Pair<KtParameter?, FirProperty>>.generateCopyFunction(
|
||||
session,
|
||||
firPrimaryConstructor.returnTypeRef,
|
||||
null,
|
||||
copyName,
|
||||
status,
|
||||
copyName,
|
||||
symbol
|
||||
).apply {
|
||||
for ((ktParameter, firProperty) in this@generateCopyFunction) {
|
||||
|
||||
@@ -562,20 +562,20 @@ class RawFirBuilder(session: FirSession, val scopeProvider: FirScopeProvider, va
|
||||
FirSealedClassImpl(
|
||||
classOrObject.toFirSourceElement(),
|
||||
session,
|
||||
classOrObject.nameAsSafeName,
|
||||
status,
|
||||
classKind,
|
||||
scopeProvider,
|
||||
classOrObject.nameAsSafeName,
|
||||
FirRegularClassSymbol(context.currentClassId)
|
||||
)
|
||||
} else {
|
||||
FirClassImpl(
|
||||
classOrObject.toFirSourceElement(),
|
||||
session,
|
||||
classOrObject.nameAsSafeName,
|
||||
status,
|
||||
classKind,
|
||||
scopeProvider,
|
||||
classOrObject.nameAsSafeName,
|
||||
FirRegularClassSymbol(context.currentClassId)
|
||||
)
|
||||
}
|
||||
@@ -653,8 +653,8 @@ class RawFirBuilder(session: FirSession, val scopeProvider: FirScopeProvider, va
|
||||
val firTypeAlias = FirTypeAliasImpl(
|
||||
typeAlias.toFirSourceElement(),
|
||||
session,
|
||||
typeAlias.nameAsSafeName,
|
||||
status,
|
||||
typeAlias.nameAsSafeName,
|
||||
FirTypeAliasSymbol(context.currentClassId),
|
||||
typeAlias.getTypeReference().toFirOrErrorType()
|
||||
)
|
||||
@@ -696,8 +696,8 @@ class RawFirBuilder(session: FirSession, val scopeProvider: FirScopeProvider, va
|
||||
session,
|
||||
returnType,
|
||||
receiverType,
|
||||
function.nameAsSafeName,
|
||||
status,
|
||||
function.nameAsSafeName,
|
||||
FirNamedFunctionSymbol(callableIdForName(function.nameAsSafeName, function.isLocal))
|
||||
)
|
||||
}
|
||||
|
||||
+2
-2
@@ -61,20 +61,20 @@ fun deserializeClassToSymbol(
|
||||
FirSealedClassImpl(
|
||||
null,
|
||||
session,
|
||||
classId.shortClassName,
|
||||
status,
|
||||
ProtoEnumFlags.classKind(kind),
|
||||
scopeProvider,
|
||||
classId.shortClassName,
|
||||
symbol
|
||||
)
|
||||
} else {
|
||||
FirClassImpl(
|
||||
null,
|
||||
session,
|
||||
classId.shortClassName,
|
||||
status,
|
||||
ProtoEnumFlags.classKind(kind),
|
||||
scopeProvider,
|
||||
classId.shortClassName,
|
||||
symbol
|
||||
)
|
||||
}
|
||||
|
||||
+2
-2
@@ -138,8 +138,8 @@ class FirMemberDeserializer(private val c: FirDeserializationContext) {
|
||||
return FirTypeAliasImpl(
|
||||
null,
|
||||
c.session,
|
||||
name,
|
||||
status,
|
||||
name,
|
||||
FirTypeAliasSymbol(ClassId(c.packageFqName, name)),
|
||||
FirResolvedTypeRefImpl(
|
||||
null,
|
||||
@@ -230,8 +230,8 @@ class FirMemberDeserializer(private val c: FirDeserializationContext) {
|
||||
c.session,
|
||||
proto.returnType(local.typeTable).toTypeRef(local),
|
||||
proto.receiverType(local.typeTable)?.toTypeRef(local),
|
||||
callableName,
|
||||
status,
|
||||
callableName,
|
||||
symbol
|
||||
).apply {
|
||||
resolvePhase = FirResolvePhase.ANALYZED_DEPENDENCIES
|
||||
|
||||
@@ -171,8 +171,8 @@ class FirSamResolverImpl(
|
||||
firSession,
|
||||
FirResolvedTypeRefImpl(null, substitutedReturnType),
|
||||
null,
|
||||
classId.shortClassName,
|
||||
status,
|
||||
classId.shortClassName,
|
||||
symbol
|
||||
).apply {
|
||||
valueParameters += listOf(
|
||||
@@ -230,8 +230,14 @@ private fun FirRegularClass.computeSamCandidateNames(session: FirSession): Set<N
|
||||
val samCandidateNames = mutableSetOf<Name>()
|
||||
for (clazz in classes) {
|
||||
for (declaration in clazz.declarations) {
|
||||
if (declaration !is FirMemberDeclaration || declaration.modality != Modality.ABSTRACT) continue
|
||||
samCandidateNames.add(declaration.name)
|
||||
when (declaration) {
|
||||
is FirProperty -> if (declaration.modality == Modality.ABSTRACT) {
|
||||
samCandidateNames.add(declaration.name)
|
||||
}
|
||||
is FirSimpleFunction -> if (declaration.modality == Modality.ABSTRACT) {
|
||||
samCandidateNames.add(declaration.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -12,7 +12,6 @@ import org.jetbrains.kotlin.fir.expressions.*
|
||||
import org.jetbrains.kotlin.fir.render
|
||||
import org.jetbrains.kotlin.fir.resolve.dfa.*
|
||||
import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.resultType
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirAnonymousFunctionSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol
|
||||
import org.jetbrains.kotlin.fir.types.isNothing
|
||||
|
||||
@@ -73,7 +72,7 @@ class ControlFlowGraphBuilder {
|
||||
is FirSimpleFunction -> function.name.asString()
|
||||
is FirPropertyAccessor -> if (function.isGetter) "<getter>" else "<setter>"
|
||||
is FirAnonymousFunction -> "<anonymous>" // TODO: add check to lambda or fun
|
||||
is FirConstructor -> function.name.asString()
|
||||
is FirConstructor -> "<init>"
|
||||
else -> throw IllegalArgumentException("Unknown function: ${function.render()}")
|
||||
}
|
||||
val invocationKind = function.invocationKind
|
||||
|
||||
+1
-1
@@ -217,7 +217,7 @@ private fun CFGNode<*>.render(): String =
|
||||
private fun FirFunction<*>.name(): String = when (this) {
|
||||
is FirSimpleFunction -> name.asString()
|
||||
is FirAnonymousFunction -> "anonymousFunction"
|
||||
is FirConstructor -> name.asString()
|
||||
is FirConstructor -> "<init>"
|
||||
is FirPropertyAccessor -> if (isGetter) "getter" else "setter"
|
||||
is FirErrorFunction -> "errorFunction"
|
||||
else -> TODO(toString())
|
||||
|
||||
+10
-4
@@ -160,10 +160,10 @@ class FirBuiltinSymbolProvider(val session: FirSession, val kotlinScopeProvider:
|
||||
FirClassImpl(
|
||||
null,
|
||||
session,
|
||||
relativeClassName.shortName(),
|
||||
status,
|
||||
ClassKind.INTERFACE,
|
||||
kotlinScopeProvider,
|
||||
relativeClassName.shortName(),
|
||||
this
|
||||
).apply klass@{
|
||||
resolvePhase = FirResolvePhase.ANALYZED_DEPENDENCIES
|
||||
@@ -218,8 +218,8 @@ class FirBuiltinSymbolProvider(val session: FirSession, val kotlinScopeProvider:
|
||||
this@FirBuiltinSymbolProvider.session,
|
||||
typeArguments.last(),
|
||||
null,
|
||||
name,
|
||||
functionStatus,
|
||||
name,
|
||||
FirNamedFunctionSymbol(CallableId(packageFqName, relativeClassName, name))
|
||||
).apply {
|
||||
resolvePhase = FirResolvePhase.ANALYZED_DEPENDENCIES
|
||||
@@ -308,7 +308,13 @@ class FirBuiltinSymbolProvider(val session: FirSession, val kotlinScopeProvider:
|
||||
}
|
||||
|
||||
override fun getAllCallableNamesInClass(classId: ClassId): Set<Name> {
|
||||
return getClassDeclarations(classId).filterIsInstance<FirMemberDeclaration>().mapTo(mutableSetOf()) { it.name }
|
||||
return getClassDeclarations(classId).mapNotNullTo(mutableSetOf()) {
|
||||
when (it) {
|
||||
is FirSimpleFunction -> it.name
|
||||
is FirVariable<*> -> it.name
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getClassDeclarations(classId: ClassId): List<FirDeclaration> {
|
||||
@@ -317,7 +323,7 @@ class FirBuiltinSymbolProvider(val session: FirSession, val kotlinScopeProvider:
|
||||
|
||||
|
||||
private fun findRegularClass(classId: ClassId): FirRegularClass? =
|
||||
getClassLikeSymbolByFqName(classId)?.fir as? FirRegularClass
|
||||
getClassLikeSymbolByFqName(classId)?.fir
|
||||
|
||||
override fun getNestedClassesNamesInClass(classId: ClassId): Set<Name> {
|
||||
return getClassDeclarations(classId).filterIsInstance<FirRegularClass>().mapTo(mutableSetOf()) { it.name }
|
||||
|
||||
+1
-1
@@ -97,8 +97,8 @@ abstract class AbstractFirUseSiteMemberScope(
|
||||
firSimpleFunction.session,
|
||||
firSimpleFunction.returnTypeRef,
|
||||
firSimpleFunction.receiverTypeRef,
|
||||
firSimpleFunction.name,
|
||||
firSimpleFunction.status,
|
||||
firSimpleFunction.name,
|
||||
newSymbol
|
||||
)
|
||||
|
||||
|
||||
+4
-5
@@ -5,10 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.fir.scopes.impl
|
||||
|
||||
import org.jetbrains.kotlin.fir.declarations.FirCallableMemberDeclaration
|
||||
import org.jetbrains.kotlin.fir.declarations.FirClass
|
||||
import org.jetbrains.kotlin.fir.declarations.FirConstructor
|
||||
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
||||
import org.jetbrains.kotlin.fir.declarations.*
|
||||
import org.jetbrains.kotlin.fir.resolve.FirSymbolProvider
|
||||
import org.jetbrains.kotlin.fir.scopes.FirScope
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol
|
||||
@@ -36,7 +33,9 @@ class FirClassDeclaredMemberScope(
|
||||
is FirCallableMemberDeclaration<*> -> {
|
||||
val name = when (declaration) {
|
||||
is FirConstructor -> if (klass is FirRegularClass) klass.name else continue@loop
|
||||
else -> declaration.name
|
||||
is FirVariable<*> -> declaration.name
|
||||
is FirSimpleFunction -> declaration.name
|
||||
else -> continue@loop
|
||||
}
|
||||
result.getOrPut(name) { mutableListOf() } += declaration.symbol
|
||||
}
|
||||
|
||||
+1
-1
@@ -225,8 +225,8 @@ class FirClassSubstitutionScope(
|
||||
session,
|
||||
baseFunction.returnTypeRef.withReplacedReturnType(newReturnType),
|
||||
baseFunction.receiverTypeRef?.withReplacedConeType(newReceiverType),
|
||||
name,
|
||||
baseFunction.status,
|
||||
name,
|
||||
fakeOverrideSymbol
|
||||
).apply {
|
||||
annotations += baseFunction.annotations
|
||||
|
||||
+1
-1
@@ -134,7 +134,7 @@ class FirIntegerOperator(
|
||||
val kind: Kind,
|
||||
status: FirDeclarationStatus,
|
||||
symbol: FirFunctionSymbol<FirSimpleFunction>
|
||||
) : FirSimpleFunctionImpl(source, session, returnTypeRef, receiverTypeRef, kind.operatorName, status, symbol) {
|
||||
) : FirSimpleFunctionImpl(source, session, returnTypeRef, receiverTypeRef, status, kind.operatorName, symbol) {
|
||||
enum class Kind(val unary: Boolean, val operatorName: Name) {
|
||||
PLUS(false, OperatorNameConventions.PLUS),
|
||||
MINUS(false, OperatorNameConventions.MINUS),
|
||||
|
||||
-2
@@ -10,7 +10,6 @@ import org.jetbrains.kotlin.fir.FirSourceElement
|
||||
import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol
|
||||
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
||||
import org.jetbrains.kotlin.fir.visitors.*
|
||||
|
||||
@@ -27,7 +26,6 @@ interface FirCallableMemberDeclaration<F : FirCallableMemberDeclaration<F>> : Fi
|
||||
override val returnTypeRef: FirTypeRef
|
||||
override val receiverTypeRef: FirTypeRef?
|
||||
override val symbol: FirCallableSymbol<F>
|
||||
override val name: Name
|
||||
override val typeParameters: List<FirTypeParameter>
|
||||
override val status: FirDeclarationStatus
|
||||
val containerSource: DeserializedContainerSource?
|
||||
|
||||
@@ -13,7 +13,6 @@ import org.jetbrains.kotlin.fir.expressions.FirDelegatedConstructorCall
|
||||
import org.jetbrains.kotlin.fir.references.FirControlFlowGraphReference
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirConstructorSymbol
|
||||
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
||||
import org.jetbrains.kotlin.fir.visitors.*
|
||||
|
||||
@@ -31,7 +30,6 @@ interface FirConstructor : FirFunction<FirConstructor>, FirCallableMemberDeclara
|
||||
override val controlFlowGraphReference: FirControlFlowGraphReference
|
||||
override val typeParameters: List<FirTypeParameter>
|
||||
override val valueParameters: List<FirValueParameter>
|
||||
override val name: Name
|
||||
override val status: FirDeclarationStatus
|
||||
override val containerSource: DeserializedContainerSource?
|
||||
override val annotations: List<FirAnnotationCall>
|
||||
|
||||
@@ -9,7 +9,6 @@ import org.jetbrains.kotlin.fir.FirAnnotationContainer
|
||||
import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.FirSourceElement
|
||||
import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.fir.visitors.*
|
||||
|
||||
/*
|
||||
@@ -22,7 +21,6 @@ interface FirMemberDeclaration : FirDeclaration, FirAnnotationContainer {
|
||||
override val session: FirSession
|
||||
override val resolvePhase: FirResolvePhase
|
||||
override val annotations: List<FirAnnotationCall>
|
||||
val name: Name
|
||||
val typeParameters: List<FirTypeParameter>
|
||||
val status: FirDeclarationStatus
|
||||
|
||||
|
||||
@@ -25,12 +25,12 @@ interface FirRegularClass : FirMemberDeclaration, FirTypeParametersOwner, FirCla
|
||||
override val session: FirSession
|
||||
override val resolvePhase: FirResolvePhase
|
||||
override val annotations: List<FirAnnotationCall>
|
||||
override val name: Name
|
||||
override val typeParameters: List<FirTypeParameter>
|
||||
override val status: FirDeclarationStatus
|
||||
override val classKind: ClassKind
|
||||
override val declarations: List<FirDeclaration>
|
||||
override val scopeProvider: FirScopeProvider
|
||||
val name: Name
|
||||
override val symbol: FirRegularClassSymbol
|
||||
val companionObject: FirRegularClass?
|
||||
override val superTypeRefs: List<FirTypeRef>
|
||||
|
||||
@@ -27,12 +27,12 @@ abstract class FirSealedClass : FirPureAbstractElement(), FirRegularClass {
|
||||
abstract override val session: FirSession
|
||||
abstract override val resolvePhase: FirResolvePhase
|
||||
abstract override val annotations: List<FirAnnotationCall>
|
||||
abstract override val name: Name
|
||||
abstract override val typeParameters: List<FirTypeParameter>
|
||||
abstract override val status: FirDeclarationStatus
|
||||
abstract override val classKind: ClassKind
|
||||
abstract override val declarations: List<FirDeclaration>
|
||||
abstract override val scopeProvider: FirScopeProvider
|
||||
abstract override val name: Name
|
||||
abstract override val symbol: FirRegularClassSymbol
|
||||
abstract override val companionObject: FirRegularClass?
|
||||
abstract override val superTypeRefs: List<FirTypeRef>
|
||||
|
||||
@@ -33,10 +33,10 @@ abstract class FirSimpleFunction : FirPureAbstractElement(), FirFunction<FirSimp
|
||||
abstract override val typeParameters: List<FirTypeParameter>
|
||||
abstract override val valueParameters: List<FirValueParameter>
|
||||
abstract override val body: FirBlock?
|
||||
abstract override val name: Name
|
||||
abstract override val status: FirDeclarationStatus
|
||||
abstract override val containerSource: DeserializedContainerSource?
|
||||
abstract override val contractDescription: FirContractDescription
|
||||
abstract val name: Name
|
||||
abstract override val symbol: FirFunctionSymbol<FirSimpleFunction>
|
||||
abstract override val annotations: List<FirAnnotationCall>
|
||||
|
||||
|
||||
@@ -23,9 +23,9 @@ abstract class FirTypeAlias : FirPureAbstractElement(), FirClassLikeDeclaration<
|
||||
abstract override val source: FirSourceElement?
|
||||
abstract override val session: FirSession
|
||||
abstract override val resolvePhase: FirResolvePhase
|
||||
abstract override val name: Name
|
||||
abstract override val typeParameters: List<FirTypeParameter>
|
||||
abstract override val status: FirDeclarationStatus
|
||||
abstract val name: Name
|
||||
abstract override val symbol: FirTypeAliasSymbol
|
||||
abstract val expandedTypeRef: FirTypeRef
|
||||
abstract override val annotations: List<FirAnnotationCall>
|
||||
|
||||
@@ -30,10 +30,10 @@ import org.jetbrains.kotlin.fir.visitors.*
|
||||
class FirClassImpl(
|
||||
override val source: FirSourceElement?,
|
||||
override val session: FirSession,
|
||||
override val name: Name,
|
||||
override var status: FirDeclarationStatus,
|
||||
override val classKind: ClassKind,
|
||||
override val scopeProvider: FirScopeProvider,
|
||||
override val name: Name,
|
||||
override val symbol: FirRegularClassSymbol
|
||||
) : FirPureAbstractElement(), FirRegularClass, FirModifiableRegularClass, FirAbstractAnnotatedElement {
|
||||
override var resolvePhase: FirResolvePhase = FirResolvePhase.RAW_FIR
|
||||
|
||||
@@ -20,7 +20,6 @@ import org.jetbrains.kotlin.fir.references.FirControlFlowGraphReference
|
||||
import org.jetbrains.kotlin.fir.references.impl.FirEmptyControlFlowGraphReference
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirConstructorSymbol
|
||||
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
||||
import org.jetbrains.kotlin.fir.visitors.*
|
||||
|
||||
@@ -41,7 +40,6 @@ open class FirConstructorImpl(
|
||||
override var controlFlowGraphReference: FirControlFlowGraphReference = FirEmptyControlFlowGraphReference()
|
||||
override val typeParameters: MutableList<FirTypeParameter> = mutableListOf()
|
||||
override val valueParameters: MutableList<FirValueParameter> = mutableListOf()
|
||||
override val name: Name = Name.special("<init>")
|
||||
override var containerSource: DeserializedContainerSource? = null
|
||||
override val annotations: MutableList<FirAnnotationCall> = mutableListOf()
|
||||
override var delegatedConstructor: FirDelegatedConstructorCall? = null
|
||||
|
||||
-2
@@ -21,7 +21,6 @@ import org.jetbrains.kotlin.fir.references.FirControlFlowGraphReference
|
||||
import org.jetbrains.kotlin.fir.references.impl.FirEmptyControlFlowGraphReference
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirConstructorSymbol
|
||||
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
||||
import org.jetbrains.kotlin.fir.visitors.*
|
||||
|
||||
@@ -39,7 +38,6 @@ abstract class FirModifiableConstructor : FirPureAbstractElement(), FirConstruct
|
||||
abstract override var controlFlowGraphReference: FirControlFlowGraphReference
|
||||
abstract override val typeParameters: MutableList<FirTypeParameter>
|
||||
abstract override val valueParameters: MutableList<FirValueParameter>
|
||||
abstract override val name: Name
|
||||
abstract override var status: FirDeclarationStatus
|
||||
abstract override var containerSource: DeserializedContainerSource?
|
||||
abstract override val annotations: MutableList<FirAnnotationCall>
|
||||
|
||||
+1
-1
@@ -31,12 +31,12 @@ interface FirModifiableRegularClass : FirRegularClass, FirModifiableClass<FirReg
|
||||
override val session: FirSession
|
||||
override var resolvePhase: FirResolvePhase
|
||||
override val annotations: MutableList<FirAnnotationCall>
|
||||
override val name: Name
|
||||
override val typeParameters: MutableList<FirTypeParameter>
|
||||
override var status: FirDeclarationStatus
|
||||
override val classKind: ClassKind
|
||||
override val declarations: MutableList<FirDeclaration>
|
||||
override val scopeProvider: FirScopeProvider
|
||||
override val name: Name
|
||||
override val symbol: FirRegularClassSymbol
|
||||
override var companionObject: FirRegularClass?
|
||||
override val superTypeRefs: MutableList<FirTypeRef>
|
||||
|
||||
+1
-1
@@ -31,10 +31,10 @@ import org.jetbrains.kotlin.fir.visitors.*
|
||||
class FirSealedClassImpl(
|
||||
override val source: FirSourceElement?,
|
||||
override val session: FirSession,
|
||||
override val name: Name,
|
||||
override var status: FirDeclarationStatus,
|
||||
override val classKind: ClassKind,
|
||||
override val scopeProvider: FirScopeProvider,
|
||||
override val name: Name,
|
||||
override val symbol: FirRegularClassSymbol
|
||||
) : FirSealedClass(), FirModifiableRegularClass, FirAbstractAnnotatedElement {
|
||||
override var resolvePhase: FirResolvePhase = FirResolvePhase.RAW_FIR
|
||||
|
||||
+1
-1
@@ -35,8 +35,8 @@ open class FirSimpleFunctionImpl(
|
||||
override val session: FirSession,
|
||||
override var returnTypeRef: FirTypeRef,
|
||||
override var receiverTypeRef: FirTypeRef?,
|
||||
override val name: Name,
|
||||
override var status: FirDeclarationStatus,
|
||||
override val name: Name,
|
||||
override val symbol: FirFunctionSymbol<FirSimpleFunction>
|
||||
) : FirSimpleFunction(), FirModifiableFunction<FirSimpleFunction>, FirModifiableTypeParametersOwner, FirAbstractAnnotatedElement {
|
||||
override var resolvePhase: FirResolvePhase = FirResolvePhase.RAW_FIR
|
||||
|
||||
+1
-1
@@ -26,8 +26,8 @@ import org.jetbrains.kotlin.fir.visitors.*
|
||||
class FirTypeAliasImpl(
|
||||
override val source: FirSourceElement?,
|
||||
override val session: FirSession,
|
||||
override val name: Name,
|
||||
override var status: FirDeclarationStatus,
|
||||
override val name: Name,
|
||||
override val symbol: FirTypeAliasSymbol,
|
||||
override var expandedTypeRef: FirTypeRef
|
||||
) : FirTypeAlias(), FirModifiableTypeParametersOwner, FirAbstractAnnotatedElement {
|
||||
|
||||
@@ -48,7 +48,7 @@ fun FirModifiableClass<out FirRegularClass>.generateValuesFunction(
|
||||
isNullable = false
|
||||
)
|
||||
),
|
||||
null, ENUM_VALUES, status, symbol
|
||||
null, status, ENUM_VALUES, symbol
|
||||
).apply {
|
||||
resolvePhase = FirResolvePhase.BODY_RESOLVE
|
||||
body = FirEmptyExpressionBlock()
|
||||
@@ -72,7 +72,7 @@ fun FirModifiableClass<out FirRegularClass>.generateValueOfFunction(
|
||||
isNullable = false
|
||||
)
|
||||
),
|
||||
null, ENUM_VALUE_OF, status, symbol
|
||||
null, status, ENUM_VALUE_OF, symbol
|
||||
).apply {
|
||||
resolvePhase = FirResolvePhase.BODY_RESOLVE
|
||||
valueParameters += FirValueParameterImpl(
|
||||
|
||||
@@ -136,7 +136,7 @@ class FirRenderer(builder: StringBuilder) : FirVisitorVoid() {
|
||||
print(".")
|
||||
}
|
||||
when (callableDeclaration) {
|
||||
is FirMemberDeclaration -> print(callableDeclaration.name)
|
||||
is FirSimpleFunction -> print(callableDeclaration.name)
|
||||
is FirVariable<*> -> print(callableDeclaration.name)
|
||||
}
|
||||
|
||||
@@ -241,7 +241,12 @@ class FirRenderer(builder: StringBuilder) : FirVisitorVoid() {
|
||||
|
||||
visitDeclaration(memberDeclaration)
|
||||
if (memberDeclaration !is FirCallableDeclaration<*>) { // Handled by visitCallableDeclaration
|
||||
print(" " + memberDeclaration.name)
|
||||
if (memberDeclaration is FirRegularClass) {
|
||||
print(" " + memberDeclaration.name)
|
||||
}
|
||||
if (memberDeclaration is FirTypeAlias) {
|
||||
print(" " + memberDeclaration.name)
|
||||
}
|
||||
if (memberDeclaration is FirTypeParametersOwner) {
|
||||
memberDeclaration.typeParameters.renderTypeParameters()
|
||||
}
|
||||
|
||||
-1
@@ -35,7 +35,6 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
|
||||
parents += modifiableConstructor
|
||||
defaultNull("delegatedConstructor")
|
||||
defaultNull("body")
|
||||
default("name", "Name.special(\"<init>\")")
|
||||
|
||||
default("isPrimary") {
|
||||
value = "false"
|
||||
|
||||
+3
-1
@@ -99,7 +99,6 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
|
||||
}
|
||||
|
||||
memberDeclaration.configure {
|
||||
+name
|
||||
+typeParameters
|
||||
+status.withTransform()
|
||||
}
|
||||
@@ -219,6 +218,7 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
|
||||
|
||||
regularClass.configure {
|
||||
parentArg(klass, "F", regularClass)
|
||||
+name
|
||||
+symbol("FirRegularClassSymbol")
|
||||
+field("companionObject", regularClass, nullable = true)
|
||||
+superTypeRefs(withReplace = true)
|
||||
@@ -235,6 +235,7 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
|
||||
|
||||
typeAlias.configure {
|
||||
parentArg(classLikeDeclaration, "F", typeAlias)
|
||||
+name
|
||||
+symbol("FirTypeAliasSymbol")
|
||||
+field("expandedTypeRef", typeRef, withReplace = true)
|
||||
+annotations
|
||||
@@ -262,6 +263,7 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
|
||||
|
||||
simpleFunction.configure {
|
||||
parentArg(function, "F", simpleFunction)
|
||||
+name
|
||||
+symbol("FirFunctionSymbol<FirSimpleFunction>")
|
||||
+annotations
|
||||
parentArg(callableMemberDeclaration, "F", simpleFunction)
|
||||
|
||||
Reference in New Issue
Block a user