[FIR] Add symbol to all declarations. Get rid of FirSymbolOwner
This commit is contained in:
+1
-1
@@ -12,7 +12,7 @@ import org.jetbrains.kotlin.fir.tree.generator.util.traverseParents
|
||||
object BuilderConfigurator : AbstractBuilderConfigurator<FirTreeBuilder>(FirTreeBuilder) {
|
||||
fun configureBuilders() = with(firTreeBuilder) {
|
||||
val declarationBuilder by builder {
|
||||
fields from declaration
|
||||
fields from declaration without "symbol"
|
||||
}
|
||||
|
||||
val annotationContainerBuilder by builder {
|
||||
|
||||
+27
-30
@@ -21,24 +21,23 @@ import org.jetbrains.kotlin.fir.tree.generator.context.type
|
||||
import org.jetbrains.kotlin.fir.tree.generator.model.*
|
||||
|
||||
object FieldSets {
|
||||
val calleeReference = field("calleeReference", reference, withReplace = true)
|
||||
val calleeReference by lazy { field("calleeReference", reference, withReplace = true) }
|
||||
|
||||
val receivers = fieldSet(
|
||||
field("explicitReceiver", expression, nullable = true, withReplace = true).withTransform(),
|
||||
field("dispatchReceiver", expression).withTransform(),
|
||||
field("extensionReceiver", expression).withTransform()
|
||||
)
|
||||
val receivers by lazy {
|
||||
fieldSet(
|
||||
field("explicitReceiver", expression, nullable = true, withReplace = true).withTransform(),
|
||||
field("dispatchReceiver", expression).withTransform(),
|
||||
field("extensionReceiver", expression).withTransform()
|
||||
)
|
||||
}
|
||||
|
||||
val typeArguments =
|
||||
fieldList("typeArguments", typeProjection, withReplace = true)
|
||||
val typeArguments by lazy { fieldList("typeArguments", typeProjection, withReplace = true) }
|
||||
|
||||
val arguments =
|
||||
fieldList("arguments", expression)
|
||||
val arguments by lazy { fieldList("arguments", expression) }
|
||||
|
||||
val declarations = fieldList(declaration)
|
||||
val declarations by lazy { fieldList(declaration.withArgs("E" to "*")) }
|
||||
|
||||
val annotations =
|
||||
fieldList("annotations", annotationCall).withTransform(needTransformInOtherChildren = true)
|
||||
val annotations by lazy { fieldList("annotations", annotationCall).withTransform(needTransformInOtherChildren = true) }
|
||||
|
||||
fun symbolWithPackage(packageName: String?, symbolClassName: String, argument: String? = null): Field {
|
||||
return field("symbol", type(packageName, symbolClassName), argument)
|
||||
@@ -50,39 +49,37 @@ object FieldSets {
|
||||
fun body(nullable: Boolean = false, withReplace: Boolean = false) =
|
||||
field("body", block, nullable, withReplace = withReplace)
|
||||
|
||||
val returnTypeRef =
|
||||
field("returnTypeRef", typeRef)
|
||||
val returnTypeRef =field("returnTypeRef", typeRef)
|
||||
|
||||
val typeRefField =
|
||||
field(typeRef, withReplace = true)
|
||||
val typeRefField = field(typeRef, withReplace = true)
|
||||
|
||||
fun receiverTypeRef(nullable: Boolean = false) = field("receiverTypeRef", typeRef, nullable)
|
||||
|
||||
val valueParameters = fieldList(valueParameter)
|
||||
val valueParameters by lazy { fieldList(valueParameter) }
|
||||
|
||||
val typeParameters = fieldList("typeParameters", typeParameter)
|
||||
val typeParameters by lazy { fieldList("typeParameters", typeParameter) }
|
||||
|
||||
val typeParameterRefs = fieldList("typeParameters", typeParameterRef)
|
||||
val typeParameterRefs by lazy { fieldList("typeParameters", typeParameterRef) }
|
||||
|
||||
val name = field(nameType)
|
||||
val name by lazy { field(nameType) }
|
||||
|
||||
val initializer = field("initializer", expression, nullable = true)
|
||||
val initializer by lazy { field("initializer", expression, nullable = true) }
|
||||
|
||||
fun superTypeRefs(withReplace: Boolean = false) = fieldList("superTypeRefs", typeRef, withReplace)
|
||||
|
||||
val classKind = field(classKindType)
|
||||
val classKind by lazy { field(classKindType) }
|
||||
|
||||
val status = field("status", declarationStatus)
|
||||
val status by lazy { field("status", declarationStatus) }
|
||||
|
||||
val controlFlowGraphReferenceField = field("controlFlowGraphReference", controlFlowGraphReference, withReplace = true, nullable = true)
|
||||
val controlFlowGraphReferenceField by lazy { field("controlFlowGraphReference", controlFlowGraphReference, withReplace = true, nullable = true) }
|
||||
|
||||
val visibility = field(visibilityType)
|
||||
val visibility by lazy { field(visibilityType) }
|
||||
|
||||
val effectiveVisibility = field("effectiveVisibility", effectiveVisibilityType)
|
||||
val effectiveVisibility by lazy { field("effectiveVisibility", effectiveVisibilityType) }
|
||||
|
||||
val modality = field(modalityType, nullable = true)
|
||||
val modality by lazy { field(modalityType, nullable = true) }
|
||||
|
||||
val scopeProvider = field("scopeProvider", firScopeProviderType)
|
||||
val scopeProvider by lazy { field("scopeProvider", firScopeProviderType) }
|
||||
|
||||
val smartcastStability = field(smartcastStabilityType)
|
||||
val smartcastStability by lazy { field(smartcastStabilityType) }
|
||||
}
|
||||
|
||||
+4
-5
@@ -15,7 +15,6 @@ object FirTreeBuilder : AbstractFirTreeBuilder() {
|
||||
val reference = element("Reference", Reference)
|
||||
val label = element("Label", Other)
|
||||
|
||||
val symbolOwner = element("SymbolOwner", Other)
|
||||
val resolvable = sealedElement("Resolvable", Expression)
|
||||
|
||||
val targetElement = element("TargetElement", Other)
|
||||
@@ -29,11 +28,11 @@ object FirTreeBuilder : AbstractFirTreeBuilder() {
|
||||
val expression = element("Expression", Expression, statement)
|
||||
val declaration = sealedElement("Declaration", Declaration)
|
||||
val annotatedDeclaration = sealedElement("AnnotatedDeclaration", Declaration, declaration, annotationContainer)
|
||||
val anonymousInitializer = element("AnonymousInitializer", Declaration, declaration, symbolOwner, controlFlowGraphOwner)
|
||||
val anonymousInitializer = element("AnonymousInitializer", Declaration, declaration, controlFlowGraphOwner)
|
||||
val typedDeclaration = sealedElement("TypedDeclaration", Declaration, annotatedDeclaration)
|
||||
val callableDeclaration = sealedElement("CallableDeclaration", Declaration, typedDeclaration, symbolOwner)
|
||||
val callableDeclaration = sealedElement("CallableDeclaration", Declaration, typedDeclaration)
|
||||
val typeParameterRef = element("TypeParameterRef", Declaration)
|
||||
val typeParameter = element("TypeParameter", Declaration, typeParameterRef, annotatedDeclaration, symbolOwner)
|
||||
val typeParameter = element("TypeParameter", Declaration, typeParameterRef, annotatedDeclaration)
|
||||
val typeParameterRefsOwner = sealedElement("TypeParameterRefsOwner", Declaration)
|
||||
val typeParametersOwner = sealedElement("TypeParametersOwner", Declaration, typeParameterRefsOwner)
|
||||
val memberDeclaration = sealedElement("MemberDeclaration", Declaration, annotatedDeclaration, typeParameterRefsOwner)
|
||||
@@ -45,7 +44,7 @@ object FirTreeBuilder : AbstractFirTreeBuilder() {
|
||||
val field = element("Field", Declaration, variable, typeParametersOwner, callableMemberDeclaration)
|
||||
val enumEntry = element("EnumEntry", Declaration, variable, callableMemberDeclaration)
|
||||
|
||||
val classLikeDeclaration = sealedElement("ClassLikeDeclaration", Declaration, annotatedDeclaration, statement, symbolOwner)
|
||||
val classLikeDeclaration = sealedElement("ClassLikeDeclaration", Declaration, annotatedDeclaration, statement)
|
||||
val klass = sealedElement("Class", Declaration, classLikeDeclaration, statement, typeParameterRefsOwner)
|
||||
val regularClass = element("RegularClass", Declaration, memberDeclaration, typeParameterRefsOwner, controlFlowGraphOwner, klass)
|
||||
val typeAlias = element("TypeAlias", Declaration, classLikeDeclaration, memberDeclaration, typeParametersOwner)
|
||||
|
||||
+4
@@ -495,6 +495,10 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
|
||||
|
||||
noImpl(userTypeRef)
|
||||
|
||||
impl(file) {
|
||||
default("symbol", "FirFileSymbol()")
|
||||
}
|
||||
|
||||
noImpl(argumentList)
|
||||
}
|
||||
|
||||
|
||||
+63
-46
@@ -46,10 +46,10 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
|
||||
+annotations
|
||||
}
|
||||
|
||||
symbolOwner.configure {
|
||||
withArg("E", symbolOwner, declaration)
|
||||
+symbolWithPackage("fir.symbols", "FirBasedSymbol", "E")
|
||||
}
|
||||
// symbolOwner.configure {
|
||||
// withArg("DE, symbolOwner, declaration)
|
||||
// +symbolWithPackage("fir.symbols", "FirBasedSymbol", "DE)
|
||||
// }
|
||||
|
||||
typeParameterRef.configure {
|
||||
+symbol(typeParameterSymbolType.type)
|
||||
@@ -76,45 +76,57 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
|
||||
}
|
||||
|
||||
declaration.configure {
|
||||
withArg("E", declaration)
|
||||
+symbolWithPackage("fir.symbols", "FirBasedSymbol", "E")
|
||||
+field("moduleData", firModuleDataType)
|
||||
+field("resolvePhase", resolvePhaseType, withReplace = true).apply { isMutable = true }
|
||||
+field("origin", declarationOriginType)
|
||||
+field("attributes", declarationAttributesType)
|
||||
}
|
||||
|
||||
annotatedDeclaration.configure {
|
||||
withArg("E", annotatedDeclaration)
|
||||
parentArg(declaration, "E", "E")
|
||||
}
|
||||
|
||||
typedDeclaration.configure {
|
||||
withArg("E", typedDeclaration)
|
||||
parentArg(annotatedDeclaration, "E", "E")
|
||||
+field("returnTypeRef", typeRef, withReplace = true).withTransform()
|
||||
}
|
||||
|
||||
callableDeclaration.configure {
|
||||
withArg("F", "FirCallableDeclaration<F>")
|
||||
parentArg(symbolOwner, "E", "F")
|
||||
withArg("E", "FirCallableDeclaration<E>")
|
||||
parentArg(typedDeclaration, "E", "E")
|
||||
+field("receiverTypeRef", typeRef, nullable = true, withReplace = true).withTransform()
|
||||
+symbol("FirCallableSymbol", "F")
|
||||
+symbol("FirCallableSymbol", "E")
|
||||
}
|
||||
|
||||
callableMemberDeclaration.configure {
|
||||
withArg("F", "FirCallableMemberDeclaration<F>")
|
||||
parentArg(callableDeclaration, "F", "F")
|
||||
withArg("E", "FirCallableMemberDeclaration<E>")
|
||||
parentArg(callableDeclaration, "E", "E")
|
||||
parentArg(memberDeclaration, "E", "E")
|
||||
+field("containerSource", type(DeserializedContainerSource::class), nullable = true)
|
||||
+field("dispatchReceiverType", coneKotlinTypeType, nullable = true)
|
||||
}
|
||||
|
||||
function.configure {
|
||||
withArg("F", "FirFunction<F>")
|
||||
parentArg(callableDeclaration, "F", "F")
|
||||
+symbol("FirFunctionSymbol", "F")
|
||||
withArg("E", "FirFunction<E>")
|
||||
parentArg(callableDeclaration, "E", "E")
|
||||
+symbol("FirFunctionSymbol", "E")
|
||||
+fieldList(valueParameter, withReplace = true).withTransform()
|
||||
+body(nullable = true, withReplace = true).withTransform()
|
||||
}
|
||||
|
||||
errorFunction.configure {
|
||||
parentArg(function, "F", errorFunction)
|
||||
parentArg(function, "E", errorFunction)
|
||||
+symbol("FirErrorFunctionSymbol")
|
||||
+typeParameters
|
||||
}
|
||||
|
||||
memberDeclaration.configure {
|
||||
withArg("E", "FirMemberDeclaration<E>")
|
||||
parentArg(annotatedDeclaration, "E", "E")
|
||||
+typeParameterRefs
|
||||
+status.withTransform()
|
||||
}
|
||||
@@ -155,7 +167,7 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
|
||||
}
|
||||
|
||||
returnExpression.configure {
|
||||
parentArg(jump, "E", function.withArgs("F" to "*"))
|
||||
parentArg(jump, "E", function.withArgs("E" to "*"))
|
||||
+field("result", expression).withTransform()
|
||||
needTransformOtherChildren()
|
||||
}
|
||||
@@ -239,15 +251,15 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
|
||||
}
|
||||
|
||||
classLikeDeclaration.configure {
|
||||
withArg("F", "FirClassLikeDeclaration<F>")
|
||||
parentArg(symbolOwner, "F", "F")
|
||||
+symbol("FirClassLikeSymbol", "F")
|
||||
withArg("E", "FirClassLikeDeclaration<E>")
|
||||
parentArg(annotatedDeclaration, "E", "E")
|
||||
+symbol("FirClassLikeSymbol", "E")
|
||||
}
|
||||
|
||||
klass.configure {
|
||||
withArg("F", "FirClass<F>")
|
||||
parentArg(classLikeDeclaration, "F", "F")
|
||||
+symbol("FirClassSymbol", "F")
|
||||
withArg("E", "FirClass<E>")
|
||||
parentArg(classLikeDeclaration, "E", "E")
|
||||
+symbol("FirClassSymbol", "E")
|
||||
+classKind
|
||||
+superTypeRefs(withReplace = true).withTransform()
|
||||
+declarations.withTransform()
|
||||
@@ -256,7 +268,8 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
|
||||
}
|
||||
|
||||
regularClass.configure {
|
||||
parentArg(klass, "F", regularClass)
|
||||
parentArg(klass, "E", regularClass)
|
||||
parentArg(memberDeclaration, "E", regularClass)
|
||||
+name
|
||||
+symbol("FirRegularClassSymbol")
|
||||
+field("companionObject", regularClass, nullable = true).withTransform()
|
||||
@@ -265,7 +278,7 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
|
||||
}
|
||||
|
||||
anonymousObject.configure {
|
||||
parentArg(klass, "F", anonymousObject)
|
||||
parentArg(klass, "E", anonymousObject)
|
||||
+symbol("FirAnonymousObjectSymbol")
|
||||
}
|
||||
|
||||
@@ -275,7 +288,8 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
|
||||
|
||||
typeAlias.configure {
|
||||
+typeParameters
|
||||
parentArg(classLikeDeclaration, "F", typeAlias)
|
||||
parentArg(classLikeDeclaration, "E", typeAlias)
|
||||
parentArg(memberDeclaration, "E", typeAlias)
|
||||
+name
|
||||
+symbol("FirTypeAliasSymbol")
|
||||
+field("expandedTypeRef", typeRef, withReplace = true).withTransform()
|
||||
@@ -283,7 +297,7 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
|
||||
}
|
||||
|
||||
anonymousFunction.configure {
|
||||
parentArg(function, "F", anonymousFunction)
|
||||
parentArg(function, "E", anonymousFunction)
|
||||
+symbol("FirAnonymousFunctionSymbol")
|
||||
+field(label, nullable = true)
|
||||
+field("invocationKind", eventOccurrencesRangeType, nullable = true, withReplace = true).apply {
|
||||
@@ -302,7 +316,7 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
|
||||
}
|
||||
|
||||
typeParameter.configure {
|
||||
parentArg(symbolOwner, "F", typeParameter)
|
||||
parentArg(annotatedDeclaration, "E", typeParameter)
|
||||
+name
|
||||
+symbol("FirTypeParameterSymbol")
|
||||
+field(varianceType)
|
||||
@@ -312,8 +326,8 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
|
||||
}
|
||||
|
||||
simpleFunction.configure {
|
||||
parentArg(function, "F", simpleFunction)
|
||||
parentArg(callableMemberDeclaration, "F", simpleFunction)
|
||||
parentArg(function, "E", simpleFunction)
|
||||
parentArg(callableMemberDeclaration, "E", simpleFunction)
|
||||
+name
|
||||
+symbol("FirNamedFunctionSymbol")
|
||||
+annotations
|
||||
@@ -325,8 +339,8 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
|
||||
}
|
||||
|
||||
property.configure {
|
||||
parentArg(variable, "F", property)
|
||||
parentArg(callableMemberDeclaration, "F", property)
|
||||
parentArg(variable, "E", property)
|
||||
parentArg(callableMemberDeclaration, "E", property)
|
||||
+symbol("FirPropertySymbol")
|
||||
+field("backingFieldSymbol", backingFieldSymbolType)
|
||||
+booleanField("isLocal")
|
||||
@@ -334,8 +348,8 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
|
||||
}
|
||||
|
||||
propertyAccessor.configure {
|
||||
parentArg(function, "F", propertyAccessor)
|
||||
parentArg(callableMemberDeclaration, "F", propertyAccessor)
|
||||
parentArg(function, "E", propertyAccessor)
|
||||
parentArg(callableMemberDeclaration, "E", propertyAccessor)
|
||||
+symbol("FirPropertyAccessorSymbol")
|
||||
+booleanField("isGetter")
|
||||
+booleanField("isSetter")
|
||||
@@ -359,8 +373,8 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
|
||||
}
|
||||
|
||||
constructor.configure {
|
||||
parentArg(function, "F", constructor)
|
||||
parentArg(callableMemberDeclaration, "F", constructor)
|
||||
parentArg(function, "E", constructor)
|
||||
parentArg(callableMemberDeclaration, "E", constructor)
|
||||
+annotations
|
||||
+symbol("FirConstructorSymbol")
|
||||
+field("delegatedConstructor", delegatedConstructorCall, nullable = true).withTransform()
|
||||
@@ -376,19 +390,20 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
|
||||
}
|
||||
|
||||
valueParameter.configure {
|
||||
parentArg(variable, "F", valueParameter)
|
||||
parentArg(variable, "E", valueParameter)
|
||||
+field("defaultValue", expression, nullable = true)
|
||||
generateBooleanFields("crossinline", "noinline", "vararg")
|
||||
}
|
||||
|
||||
variable.configure {
|
||||
withArg("F", variable)
|
||||
parentArg(callableDeclaration, "F", "F")
|
||||
withArg("E", variable)
|
||||
parentArg(callableDeclaration, "E", "E")
|
||||
parentArg(annotatedDeclaration, "E", "E")
|
||||
+name
|
||||
+symbol("FirVariableSymbol", "F")
|
||||
+symbol("FirVariableSymbol", "E")
|
||||
+initializer.withTransform().withReplace()
|
||||
+field("delegate", expression, nullable = true).withTransform()
|
||||
+field("delegateFieldSymbol", delegateFieldSymbolType, "F", nullable = true)
|
||||
+field("delegateFieldSymbol", delegateFieldSymbolType, "E", nullable = true)
|
||||
generateBooleanFields("var", "val")
|
||||
+field("getter", propertyAccessor, nullable = true).withTransform()
|
||||
+field("setter", propertyAccessor, nullable = true).withTransform()
|
||||
@@ -397,31 +412,33 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
|
||||
}
|
||||
|
||||
errorProperty.configure {
|
||||
parentArg(variable, "F", errorProperty)
|
||||
parentArg(variable, "E", errorProperty)
|
||||
+symbol("FirErrorPropertySymbol")
|
||||
}
|
||||
|
||||
enumEntry.configure {
|
||||
parentArg(variable, "F", enumEntry)
|
||||
parentArg(callableMemberDeclaration, "F", enumEntry)
|
||||
parentArg(variable, "E", enumEntry)
|
||||
parentArg(callableMemberDeclaration, "E", enumEntry)
|
||||
}
|
||||
|
||||
field.configure {
|
||||
parentArg(variable, "F", field)
|
||||
parentArg(callableMemberDeclaration, "F", field)
|
||||
parentArg(variable, "E", field)
|
||||
parentArg(callableMemberDeclaration, "E", field)
|
||||
}
|
||||
|
||||
anonymousInitializer.configure {
|
||||
parentArg(symbolOwner, "E", anonymousInitializer)
|
||||
parentArg(declaration, "E", anonymousInitializer)
|
||||
+body(nullable = true)
|
||||
+symbol(anonymousInitializerSymbolType.type)
|
||||
}
|
||||
|
||||
file.configure {
|
||||
parentArg(annotatedDeclaration, "E", file)
|
||||
+fieldList(import).withTransform()
|
||||
+declarations.withTransform()
|
||||
+stringField("name")
|
||||
+field("packageFqName", fqNameType)
|
||||
+symbol(fileSymbolType.type)
|
||||
}
|
||||
|
||||
import.configure {
|
||||
@@ -621,7 +638,7 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
|
||||
|
||||
whenExpression.configure {
|
||||
+field("subject", expression, nullable = true).withTransform()
|
||||
+field("subjectVariable", variable.withArgs("F" to "*"), nullable = true)
|
||||
+field("subjectVariable", variable.withArgs("E" to "*"), nullable = true)
|
||||
+fieldList("branches", whenBranch).withTransform()
|
||||
+field("exhaustivenessStatus", exhaustivenessStatusType, nullable = true, withReplace = true)
|
||||
+booleanField("usedAsExpression")
|
||||
@@ -652,7 +669,7 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
|
||||
}
|
||||
}
|
||||
|
||||
private fun Element.withArgs(vararg replacements: Pair<String, String>): AbstractElement {
|
||||
fun Element.withArgs(vararg replacements: Pair<String, String>): AbstractElement {
|
||||
val replaceMap = replacements.toMap()
|
||||
val newArguments = typeArguments.map { replaceMap[it.name]?.let { SimpleTypeArgument(it, null) } ?: it }
|
||||
return ElementWithArguments(this, newArguments)
|
||||
|
||||
@@ -72,6 +72,7 @@ val typeParameterSymbolType = type("fir.symbols.impl", "FirTypeParameterSymbol")
|
||||
val emptyArgumentListType = type("fir.expressions", "FirEmptyArgumentList")
|
||||
val firScopeProviderType = type("fir.scopes", "FirScopeProvider")
|
||||
val anonymousInitializerSymbolType = type("fir.symbols.impl", "FirAnonymousInitializerSymbol")
|
||||
val fileSymbolType = type("fir.symbols.impl", "FirFileSymbol")
|
||||
|
||||
val pureAbstractElementType = generatedType("FirPureAbstractElement")
|
||||
val coneEffectDeclarationType = type("fir.contracts.description", "ConeEffectDeclaration")
|
||||
|
||||
+2
-1
@@ -20,6 +20,7 @@ interface FieldContainer {
|
||||
}
|
||||
|
||||
interface AbstractElement : FieldContainer, KindOwner {
|
||||
val name: String
|
||||
val fields: Set<Field>
|
||||
val parents: List<AbstractElement>
|
||||
val typeArguments: List<TypeArgument>
|
||||
@@ -41,7 +42,7 @@ interface AbstractElement : FieldContainer, KindOwner {
|
||||
override val allParents: List<KindOwner> get() = parents
|
||||
}
|
||||
|
||||
class Element(val name: String, kind: Kind) : AbstractElement {
|
||||
class Element(override val name: String, kind: Kind) : AbstractElement {
|
||||
companion object {
|
||||
private val allowedKinds = setOf(
|
||||
Implementation.Kind.Interface,
|
||||
|
||||
+2
-2
@@ -66,7 +66,7 @@ fun fieldList(name: String, type: Importable, withReplace: Boolean = false): Fie
|
||||
return FieldList(name, type, withReplace)
|
||||
}
|
||||
|
||||
fun fieldList(element: Element, withReplace: Boolean = false): Field {
|
||||
fun fieldList(element: AbstractElement, withReplace: Boolean = false): Field {
|
||||
return FieldList(element.name.replaceFirstChar(Char::lowercaseChar) + "s", element, withReplace)
|
||||
}
|
||||
|
||||
@@ -96,4 +96,4 @@ fun Field.withReplace(): Field = copy().apply {
|
||||
withReplace = true
|
||||
}
|
||||
|
||||
fun FieldSet.withTransform(): FieldSet = this.map { it.withTransform() }
|
||||
fun FieldSet.withTransform(): FieldSet = this.map { it.withTransform() }
|
||||
|
||||
+1
-1
@@ -205,5 +205,5 @@ class FieldList(
|
||||
)
|
||||
}
|
||||
|
||||
override val isFirType: Boolean = baseType is Element
|
||||
override val isFirType: Boolean = baseType is AbstractElement
|
||||
}
|
||||
|
||||
+1
-2
@@ -7,7 +7,6 @@ package org.jetbrains.kotlin.fir.tree.generator.util
|
||||
|
||||
import org.jetbrains.kotlin.fir.tree.generator.context.AbstractFirTreeBuilder
|
||||
import org.jetbrains.kotlin.fir.tree.generator.model.AbstractElement
|
||||
import org.jetbrains.kotlin.fir.tree.generator.model.Element
|
||||
import org.jetbrains.kotlin.fir.tree.generator.model.FieldList
|
||||
import org.jetbrains.kotlin.fir.tree.generator.model.FirField
|
||||
|
||||
@@ -17,7 +16,7 @@ fun detectBaseTransformerTypes(builder: AbstractFirTreeBuilder) {
|
||||
for (field in element.allFirFields) {
|
||||
val fieldElement = when (field) {
|
||||
is FirField -> field.element
|
||||
is FieldList -> field.baseType as Element
|
||||
is FieldList -> field.baseType as AbstractElement
|
||||
else -> throw IllegalArgumentException()
|
||||
}
|
||||
usedAsFieldType[fieldElement] = true
|
||||
|
||||
Reference in New Issue
Block a user