[FIR] Add contract description classes to fir
This commit is contained in:
+6
-3
@@ -49,9 +49,10 @@ object FirTreeBuilder : AbstractFirTreeBuilder() {
|
||||
|
||||
val function = element("Function", Declaration, callableDeclaration, controlFlowGraphOwner, targetElement, annotationContainer, typeParametersOwner, statement)
|
||||
|
||||
val contractDescriptionOwner = element("ContractDescriptionOwner", Declaration)
|
||||
val memberFunction = element("MemberFunction", Declaration, function, callableMemberDeclaration)
|
||||
val simpleFunction = element("SimpleFunction", Declaration, memberFunction)
|
||||
val propertyAccessor = element("PropertyAccessor", Declaration, function)
|
||||
val simpleFunction = element("SimpleFunction", Declaration, memberFunction, contractDescriptionOwner)
|
||||
val propertyAccessor = element("PropertyAccessor", Declaration, function, contractDescriptionOwner)
|
||||
val constructor = element("Constructor", Declaration, memberFunction)
|
||||
val file = element("File", Declaration, annotationContainer, declaration)
|
||||
|
||||
@@ -132,4 +133,6 @@ object FirTreeBuilder : AbstractFirTreeBuilder() {
|
||||
val functionTypeRef = element("FunctionTypeRef", TypeRef, typeRefWithNullability)
|
||||
val resolvedFunctionTypeRef = element("ResolvedFunctionTypeRef", TypeRef, resolvedTypeRef, functionTypeRef)
|
||||
val implicitTypeRef = element("ImplicitTypeRef", TypeRef, typeRef)
|
||||
}
|
||||
|
||||
val contractDescription = element("ContractDescription", Contracts)
|
||||
}
|
||||
+4
-1
@@ -402,7 +402,8 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
|
||||
withGetter = true
|
||||
}
|
||||
defaultNull("body")
|
||||
useTypes(modalityType)
|
||||
default("contractDescription", "FirEmptyContractDescription")
|
||||
useTypes(modalityType, emptyContractDescriptionType)
|
||||
kind = OpenClass
|
||||
}
|
||||
|
||||
@@ -556,6 +557,8 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
|
||||
parents += modifiableFunction.withArg(simpleFunction)
|
||||
parents += modifiableTypeParametersOwner
|
||||
defaultNull("body")
|
||||
default("contractDescription", "FirEmptyContractDescription")
|
||||
useTypes(emptyContractDescriptionType)
|
||||
}
|
||||
|
||||
impl(delegatedTypeRef) {
|
||||
|
||||
+8
@@ -266,6 +266,10 @@ object NodeConfigurator : AbstractFieldConfigurator() {
|
||||
parentArg(memberFunction, "F", simpleFunction)
|
||||
}
|
||||
|
||||
contractDescriptionOwner.configure {
|
||||
+field(contractDescription).withTransform()
|
||||
}
|
||||
|
||||
property.configure {
|
||||
parentArg(variable, "F", property)
|
||||
parentArg(callableMemberDeclaration, "F", property)
|
||||
@@ -524,6 +528,10 @@ object NodeConfigurator : AbstractFieldConfigurator() {
|
||||
errorNamedReference.configure {
|
||||
+stringField("errorReason")
|
||||
}
|
||||
|
||||
contractDescription.configure {
|
||||
+fieldList("effects", effectDeclarationType)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -61,4 +61,6 @@ val backingFieldSymbolType = type("fir.symbols.impl", "FirBackingFieldSymbol")
|
||||
val delegateFieldSymbolType = type("fir.symbols.impl", "FirDelegateFieldSymbol")
|
||||
val classSymbolType = type("fir.symbols.impl", "FirClassSymbol")
|
||||
|
||||
val pureAbstractElementType = generatedType("FirPureAbstractElement")
|
||||
val pureAbstractElementType = generatedType("FirPureAbstractElement")
|
||||
val effectDeclarationType = type("fir.contracts.description", "ConeEffectDeclaration")
|
||||
val emptyContractDescriptionType = generatedType("contracts.impl", "FirEmptyContractDescription")
|
||||
+1
@@ -124,6 +124,7 @@ class Element(val name: String, kind: Kind) : AbstractElement {
|
||||
Declaration("declarations"),
|
||||
Reference("references"),
|
||||
TypeRef("types"),
|
||||
Contracts("contracts"),
|
||||
Other("")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user