[FIR] Change scheme of generating declarations by plugins

Methods `needToGenerateAdditionalMembersInClass` and
  `needToGenerateNestedClassifiersInClass` are removed, now compiler
  uses `get...Names` and `getTopLevel...` methods to determine which
  extension may generate declaration with specific classId/callableId

This is needed to simplify API of FirDeclarationGenerationExtension and
  provide guarantee that `generate...` method will be called with
  specific classId/callableId only if specific extensions returned name
  for this id from `getName...` functions
This commit is contained in:
Dmitriy Novozhilov
2021-11-15 12:57:26 +03:00
committed by teamcityserver
parent 40d8451698
commit cb0705ec03
25 changed files with 388 additions and 228 deletions
@@ -45,3 +45,6 @@ abstract class FirDeclarationPredicateRegistrar {
abstract fun register(vararg predicates: DeclarationPredicate)
abstract fun register(predicates: Collection<DeclarationPredicate>)
}
@RequiresOptIn
annotation class FirExtensionApiInternals
@@ -12,9 +12,7 @@ import org.jetbrains.kotlin.fir.expressions.FirDelegatedConstructorCall
import org.jetbrains.kotlin.fir.references.FirControlFlowGraphReference
import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference
import org.jetbrains.kotlin.fir.symbols.ensureResolved
import org.jetbrains.kotlin.name.CallableId
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.name.*
sealed class FirFunctionSymbol<D : FirFunction>(
override val callableId: CallableId
@@ -57,6 +55,8 @@ class FirIntersectionOverrideFunctionSymbol(
class FirConstructorSymbol(
callableId: CallableId
) : FirFunctionSymbol<FirConstructor>(callableId) {
constructor(classId: ClassId) : this(classId.callableIdForConstructor())
val isPrimary: Boolean
get() = fir.isPrimary