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