[FIR] Make anonymous initializer lazy in RawFirBuilder
Fourth step for KT-52615 Merge-request: KT-MR-7798 Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
This commit is contained in:
@@ -1083,12 +1083,6 @@ open class RawFirBuilder(
|
||||
}
|
||||
}
|
||||
|
||||
override fun visitClassInitializer(initializer: KtClassInitializer, data: Unit?): FirElement {
|
||||
return disabledLazyMode {
|
||||
super.visitClassInitializer(initializer, data)
|
||||
}
|
||||
}
|
||||
|
||||
private fun convertContextReceivers(receivers: List<KtContextReceiver>): List<FirContextReceiver> {
|
||||
return receivers.map { contextReceiverElement ->
|
||||
buildContextReceiver {
|
||||
@@ -1746,7 +1740,7 @@ open class RawFirBuilder(
|
||||
source = initializer.toFirSourceElement()
|
||||
moduleData = baseModuleData
|
||||
origin = FirDeclarationOrigin.Source
|
||||
body = initializer.body.toFirBlock()
|
||||
body = buildOrLazyBlock { initializer.body.toFirBlock() }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-2
@@ -4,8 +4,7 @@ FILE: constructorInObject.kt
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
init {
|
||||
}
|
||||
init { LAZY_BLOCK }
|
||||
|
||||
}
|
||||
public? final? enum class B : R|kotlin/Enum<B>| {
|
||||
|
||||
+1
-72
@@ -4,77 +4,6 @@ FILE: enums3.kt
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
init {
|
||||
local final? enum class Planet : R|kotlin/Enum<C.Planet>| {
|
||||
private constructor(m: Double, r: Double): R|C.Planet| {
|
||||
super<R|kotlin/Enum<C.Planet>|>()
|
||||
}
|
||||
|
||||
public? final? val m: Double = R|<local>/m|
|
||||
public? get(): Double
|
||||
|
||||
internal final? val r: Double = R|<local>/r|
|
||||
internal get(): Double
|
||||
|
||||
public final static enum entry MERCURY: R|C.Planet| = object : R|C.Planet| {
|
||||
private constructor(): R|<anonymous>| {
|
||||
super<R|C.Planet|>(Double(1.0), Double(2.0))
|
||||
}
|
||||
|
||||
public? open? override fun sayHello(): R|kotlin/Unit| {
|
||||
println#(String(Hello!!!))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public final static enum entry VENERA: R|C.Planet| = object : R|C.Planet| {
|
||||
private constructor(): R|<anonymous>| {
|
||||
super<R|C.Planet|>(Double(3.0), Double(4.0))
|
||||
}
|
||||
|
||||
public? open? override fun sayHello(): R|kotlin/Unit| {
|
||||
println#(String(Ola!!!))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public final static enum entry EARTH: R|C.Planet| = object : R|C.Planet| {
|
||||
private constructor(): R|<anonymous>| {
|
||||
super<R|C.Planet|>(Double(5.0), Double(6.0))
|
||||
}
|
||||
|
||||
public? open? override fun sayHello(): R|kotlin/Unit| {
|
||||
println#(String(Privet!!!))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public? final? val g: Double = G#.times#(m#).div#(r#.times#(r#))
|
||||
public? get(): Double
|
||||
|
||||
public? abstract fun sayHello(): R|kotlin/Unit|
|
||||
|
||||
local final? companion object Companion : R|kotlin/Any| {
|
||||
private constructor(): R|C.Planet.Companion| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public? final? const val G: <implicit> = Double(6.67E-11)
|
||||
public? get(): <implicit>
|
||||
|
||||
}
|
||||
|
||||
public final static fun values(): R|kotlin/Array<C.Planet>| {
|
||||
}
|
||||
|
||||
public final static fun valueOf(value: R|kotlin/String|): R|C.Planet| {
|
||||
}
|
||||
|
||||
public final static val entries: R|kotlin/enums/EnumEntries<C.Planet>|
|
||||
public get(): R|kotlin/enums/EnumEntries<C.Planet>|
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
init { LAZY_BLOCK }
|
||||
|
||||
}
|
||||
|
||||
+2
-30
@@ -4,21 +4,7 @@ FILE: initBlockWithDeclarations.kt
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
init {
|
||||
local final? class classInInit : R|kotlin/Any| {
|
||||
public? constructor(): R|X.classInInit| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public? final? fun funInClassInInit(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
local final? fun funInInit(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
init { LAZY_BLOCK }
|
||||
|
||||
}
|
||||
public? final? object <no name provided> : R|kotlin/Any| {
|
||||
@@ -26,20 +12,6 @@ FILE: initBlockWithDeclarations.kt
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
init {
|
||||
local final? class classInInit : R|kotlin/Any| {
|
||||
public? constructor(): R|<no name provided>.classInInit| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public? final? fun funInClassInInit(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
local final? fun funInInit(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
init { LAZY_BLOCK }
|
||||
|
||||
}
|
||||
|
||||
+1
-3
@@ -7,8 +7,6 @@ FILE: init.kt
|
||||
public? final? val x: Int
|
||||
public? get(): Int
|
||||
|
||||
init {
|
||||
this#.x# = x#
|
||||
}
|
||||
init { LAZY_BLOCK }
|
||||
|
||||
}
|
||||
|
||||
@@ -40,5 +40,7 @@ abstract class FirAnonymousInitializer : FirDeclaration(), FirControlFlowGraphOw
|
||||
|
||||
abstract override fun replaceControlFlowGraphReference(newControlFlowGraphReference: FirControlFlowGraphReference?)
|
||||
|
||||
abstract fun replaceBody(newBody: FirBlock?)
|
||||
|
||||
abstract override fun <D> transformAnnotations(transformer: FirTransformer<D>, data: D): FirAnonymousInitializer
|
||||
}
|
||||
|
||||
+4
@@ -63,4 +63,8 @@ internal class FirAnonymousInitializerImpl(
|
||||
override fun replaceControlFlowGraphReference(newControlFlowGraphReference: FirControlFlowGraphReference?) {
|
||||
controlFlowGraphReference = newControlFlowGraphReference
|
||||
}
|
||||
|
||||
override fun replaceBody(newBody: FirBlock?) {
|
||||
body = newBody
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -437,7 +437,7 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
|
||||
}
|
||||
|
||||
anonymousInitializer.configure {
|
||||
+body(nullable = true)
|
||||
+body(nullable = true, withReplace = true)
|
||||
+symbol("FirAnonymousInitializerSymbol")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user