[FIR] Add FirErrorProperty node

This commit is contained in:
Dmitriy Novozhilov
2020-06-11 15:05:45 +03:00
parent 535534cf66
commit 7c57c4a2fb
10 changed files with 320 additions and 11 deletions
@@ -95,6 +95,7 @@ object FirTreeBuilder : AbstractFirTreeBuilder() {
val classReferenceExpression = element("ClassReferenceExpression", Expression, expression)
val errorExpression = element("ErrorExpression", Expression, expression, diagnosticHolder)
val errorFunction = element("ErrorFunction", Declaration, function, diagnosticHolder, typeParametersOwner)
val errorProperty = element("ErrorProperty", Declaration, variable, diagnosticHolder, typeParametersOwner)
val qualifiedAccessExpression = element("QualifiedAccessExpression", Expression, expression, qualifiedAccess)
val functionCall = element("FunctionCall", Expression, qualifiedAccessExpression, call)
val delegatedConstructorCall = element("DelegatedConstructorCall", Expression, resolvable, call)
@@ -146,6 +146,18 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
}
}
val errorTypeRefImpl = impl(errorTypeRef) {
default("type", "ConeClassErrorType(diagnostic.reason)")
default("delegatedTypeRef") {
value = "null"
withGetter = true
}
default("annotations", "mutableListOf()")
defaultFalse("isSuspend")
useTypes(coneClassErrorTypeType)
}
impl(property) {
default("isVal") {
value = "!isVar"
@@ -156,6 +168,22 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
useTypes(backingFieldSymbolType, delegateFieldSymbolType)
}
impl(errorProperty) {
defaultTrue("isVal", withGetter = true)
defaultFalse("isVar", withGetter = true)
defaultNull(
"receiverTypeRef",
"initializer",
"delegate",
"delegateFieldSymbol",
"getter", "setter",
withGetter = true
)
default("returnTypeRef", "FirErrorTypeRefImpl(null, diagnostic)")
useTypes(errorTypeRefImpl)
}
impl(field) {
default("isVal") {
value = "!isVar"
@@ -354,17 +382,6 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
impl(resolvedTypeRef)
val errorTypeRefImpl = impl(errorTypeRef) {
default("type", "ConeClassErrorType(diagnostic.reason)")
default("delegatedTypeRef") {
value = "null"
withGetter = true
}
default("annotations", "mutableListOf()")
defaultFalse("isSuspend")
useTypes(coneClassErrorTypeType)
}
impl(errorExpression) {
defaultEmptyList("annotations")
default("typeRef", "FirErrorTypeRefImpl(source, ConeStubDiagnostic(diagnostic))")
@@ -368,6 +368,11 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
needTransformOtherChildren()
}
errorProperty.configure {
parentArg(variable, "F", errorProperty)
+symbol("FirErrorPropertySymbol")
}
enumEntry.configure {
parentArg(variable, "F", enumEntry)
parentArg(callableMemberDeclaration, "F", enumEntry)