FIR: introduce FirLazyBlock node

This commit is contained in:
Ilya Kirillov
2020-10-09 11:30:01 +03:00
parent 864800902b
commit 4fae9cbdb0
19 changed files with 167 additions and 5 deletions
@@ -47,8 +47,8 @@ object FieldSets {
fun symbol(symbolClassName: String, argument: String? = null): Field =
symbolWithPackage("fir.symbols.impl", symbolClassName, argument)
fun body(nullable: Boolean = false) =
field("body", block, nullable)
fun body(nullable: Boolean = false, withReplace: Boolean = false) =
field("body", block, nullable, withReplace = withReplace)
val returnTypeRef =
field("returnTypeRef", typeRef)
@@ -113,6 +113,23 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
publicImplementation()
}
impl(block, "FirLazyBlock") {
val error = """error("FirLazyBlock should be calculated before accessing")"""
default("statements") {
value = error
withGetter = true
}
default("annotations") {
value = error
withGetter = true
}
default("typeRef") {
value = error
withGetter = true
}
publicImplementation()
}
impl(errorLoop) {
default("block", "FirEmptyExpressionBlock()")
default("condition", "FirErrorExpressionImpl(source, ConeStubDiagnostic(diagnostic))")
@@ -102,7 +102,7 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
parentArg(callableDeclaration, "F", "F")
+symbol("FirFunctionSymbol", "F")
+fieldList(valueParameter, withReplace = true).withTransform()
+body(nullable = true).withTransform()
+body(nullable = true, withReplace = true).withTransform()
}
errorFunction.configure {