[FIR] Create 'FirCodeFragment' with a lazy block if requested

This commit is contained in:
Yan Zhulanow
2023-07-13 18:20:59 +09:00
committed by Space Team
parent 6896684d36
commit 4b43e72440
@@ -1197,10 +1197,12 @@ open class PsiRawFirBuilder(
moduleData = baseModuleData
origin = FirDeclarationOrigin.Source
symbol = FirCodeFragmentSymbol()
block = when (file) {
is KtExpressionCodeFragment -> file.getContentElement()?.toFirBlock() ?: buildEmptyExpressionBlock()
is KtBlockCodeFragment -> configureBlockWithoutBuilding(file.getContentElement()).build()
else -> error("Unexpected code fragment type: ${file::class}")
block = buildOrLazyBlock {
when (file) {
is KtExpressionCodeFragment -> file.getContentElement()?.toFirBlock() ?: buildEmptyExpressionBlock()
is KtBlockCodeFragment -> configureBlockWithoutBuilding(file.getContentElement()).build()
else -> error("Unexpected code fragment type: ${file::class}")
}
}
}
}