FIR: render constructor resolve phase in FirRenderer when renderDeclarationResolvePhase is requested

This commit is contained in:
Ilya Kirillov
2020-12-18 15:58:48 +01:00
parent 85c65e20b3
commit 1e2536402d
8 changed files with 15 additions and 10 deletions
@@ -340,9 +340,7 @@ class FirRenderer(builder: StringBuilder, private val mode: RenderMode = RenderM
} }
override fun visitDeclaration(declaration: FirDeclaration) { override fun visitDeclaration(declaration: FirDeclaration) {
if (mode.renderDeclarationResolvePhase) { declaration.renderPhaseIfNeeded()
print("[${declaration.resolvePhase}] ")
}
print( print(
when (declaration) { when (declaration) {
is FirRegularClass -> declaration.classKind.name.toLowerCase().replace("_", " ") is FirRegularClass -> declaration.classKind.name.toLowerCase().replace("_", " ")
@@ -359,6 +357,12 @@ class FirRenderer(builder: StringBuilder, private val mode: RenderMode = RenderM
) )
} }
private fun FirDeclaration.renderPhaseIfNeeded() {
if (mode.renderDeclarationResolvePhase) {
print("[${resolvePhase}] ")
}
}
private fun List<FirDeclaration>.renderDeclarations() { private fun List<FirDeclaration>.renderDeclarations() {
renderInBraces { renderInBraces {
for (declaration in this) { for (declaration in this) {
@@ -458,6 +462,7 @@ class FirRenderer(builder: StringBuilder, private val mode: RenderMode = RenderM
if (constructor.isActual) { if (constructor.isActual) {
print("actual ") print("actual ")
} }
constructor.renderPhaseIfNeeded()
print("constructor") print("constructor")
constructor.typeParameters.renderTypeParameters() constructor.typeParameters.renderTypeParameters()
constructor.valueParameters.renderParameters() constructor.valueParameters.renderParameters()
@@ -1,6 +1,6 @@
FILE: classMembers.kt FILE: classMembers.kt
public final [BODY_RESOLVE] class A : R|kotlin/Any| { public final [BODY_RESOLVE] class A : R|kotlin/Any| {
public constructor(): R|A| { public [CONTRACTS] constructor(): R|A| {
super<R|kotlin/Any|>() super<R|kotlin/Any|>()
} }
@@ -7,7 +7,7 @@ FILE: delegates.kt
} }
public final [STATUS] fun receive(value: R|kotlin/Int|): R|kotlin/Unit| { LAZY_BLOCK } public final [STATUS] fun receive(value: R|kotlin/Int|): R|kotlin/Unit| { LAZY_BLOCK }
public final [IMPLICIT_TYPES_BODY_RESOLVE] val delegate: R|kotlin/properties/ReadWriteProperty<kotlin/Any?, kotlin/Int>| = object : R|kotlin/properties/ReadWriteProperty<kotlin/Any?, kotlin/Int>| { public final [IMPLICIT_TYPES_BODY_RESOLVE] val delegate: R|kotlin/properties/ReadWriteProperty<kotlin/Any?, kotlin/Int>| = object : R|kotlin/properties/ReadWriteProperty<kotlin/Any?, kotlin/Int>| {
private constructor(): R|<anonymous>| { private [BODY_RESOLVE] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>() super<R|kotlin/Any|>()
} }
@@ -4,6 +4,6 @@ FILE: secondaryConstructor.kt
} }
public final [STATUS] fun receive(value: R|A|): R|kotlin/Unit| { LAZY_BLOCK } public final [STATUS] fun receive(value: R|A|): R|kotlin/Unit| { LAZY_BLOCK }
public final [STATUS] class A : R|kotlin/Any| { public final [STATUS] class A : R|kotlin/Any| {
public constructor(x: R|kotlin/Int|): R|A| { LAZY_BLOCK } public [STATUS] constructor(x: R|kotlin/Int|): R|A| { LAZY_BLOCK }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
FILE: main.kt FILE: main.kt
public final [BODY_RESOLVE] class WithElvis : R|kotlin/Any| { public final [BODY_RESOLVE] class WithElvis : R|kotlin/Any| {
public constructor(value: R|kotlin/String?|): R|elvis/WithElvis| { public [CONTRACTS] constructor(value: R|kotlin/String?|): R|elvis/WithElvis| {
super<R|kotlin/Any|>() super<R|kotlin/Any|>()
} }
+1 -1
View File
@@ -1,6 +1,6 @@
FILE: main.kt FILE: main.kt
public final [BODY_RESOLVE] class Foo : R|kotlin/Any| { public final [BODY_RESOLVE] class Foo : R|kotlin/Any| {
public constructor(): R|Foo| { public [BODY_RESOLVE] constructor(): R|Foo| {
super<R|kotlin/Any|>() super<R|kotlin/Any|>()
} }
+1 -1
View File
@@ -3,7 +3,7 @@ FILE: main.kt
public final [CONTRACTS] val x: R|kotlin/Int| public final [CONTRACTS] val x: R|kotlin/Int|
public get(): R|kotlin/Int| public get(): R|kotlin/Int|
public constructor(): R|Foo| { public [BODY_RESOLVE] constructor(): R|Foo| {
super<R|kotlin/Any|>() super<R|kotlin/Any|>()
this@R|/Foo|.R|/Foo.x| = Int(42) this@R|/Foo|.R|/Foo.x| = Int(42)
} }
+1 -1
View File
@@ -1,6 +1,6 @@
FILE: main.kt FILE: main.kt
public final [STATUS] class My : R|kotlin/Any| { public final [STATUS] class My : R|kotlin/Any| {
public constructor(): R|My| { public [STATUS] constructor(): R|My| {
super<R|kotlin/Any|>() super<R|kotlin/Any|>()
} }