FIR: render value parameter/lambda/accessor resolve phase if RenderMode.renderDeclarationResolvePhase is enabled

This commit is contained in:
Ilya Kirillov
2021-02-25 18:45:25 +01:00
parent 869a153327
commit ded234074d
15 changed files with 32 additions and 29 deletions
@@ -511,6 +511,7 @@ class FirRenderer(builder: StringBuilder, private val mode: RenderMode = RenderM
}
override fun visitPropertyAccessor(propertyAccessor: FirPropertyAccessor) {
propertyAccessor.renderPhaseIfNeeded()
propertyAccessor.annotations.renderAnnotations()
print(propertyAccessor.visibility.asString() + " ")
print(if (propertyAccessor.isGetter) "get" else "set")
@@ -522,6 +523,7 @@ class FirRenderer(builder: StringBuilder, private val mode: RenderMode = RenderM
}
override fun visitAnonymousFunction(anonymousFunction: FirAnonymousFunction) {
anonymousFunction.renderPhaseIfNeeded()
anonymousFunction.annotations.renderAnnotations()
val label = anonymousFunction.label
if (label != null) {
@@ -620,6 +622,7 @@ class FirRenderer(builder: StringBuilder, private val mode: RenderMode = RenderM
}
override fun visitValueParameter(valueParameter: FirValueParameter) {
valueParameter.renderPhaseIfNeeded()
valueParameter.annotations.renderAnnotations()
if (valueParameter.isCrossinline) {
print("crossinline ")
@@ -9,9 +9,9 @@ FILE: classMembers.kt
}
public final [CONTRACTS] val x: R|kotlin/Int| = LAZY_EXPRESSION
public get(): R|kotlin/Int| { LAZY_BLOCK }
[STATUS] public get(): R|kotlin/Int| { LAZY_BLOCK }
public final [CONTRACTS] fun receive(value: R|kotlin/String|): R|kotlin/Unit| { LAZY_BLOCK }
public final [CONTRACTS] fun receive([STATUS] value: R|kotlin/String|): R|kotlin/Unit| { LAZY_BLOCK }
public final [CONTRACTS] fun functionWithLazyBody(): R|kotlin/String| { LAZY_BLOCK }
@@ -5,41 +5,41 @@ FILE: delegates.kt
R|/variableWithExplicitType| = Int(10)
R|/variableWithImplicitType| = Int(10)
}
public final [STATUS] fun receive(value: R|kotlin/Int|): R|kotlin/Unit| { LAZY_BLOCK }
public final [STATUS] fun receive([STATUS] 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>| {
private [BODY_RESOLVE] constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public final override operator [BODY_RESOLVE] fun getValue(thisRef: R|kotlin/Any?|, property: R|kotlin/reflect/KProperty<*>|): R|kotlin/Int| {
public final override operator [BODY_RESOLVE] fun getValue([BODY_RESOLVE] thisRef: R|kotlin/Any?|, [BODY_RESOLVE] property: R|kotlin/reflect/KProperty<*>|): R|kotlin/Int| {
^getValue Int(1)
}
public final override operator [BODY_RESOLVE] fun setValue(thisRef: R|kotlin/Any?|, property: R|kotlin/reflect/KProperty<*>|, value: R|kotlin/Int|): R|kotlin/Unit| {
public final override operator [BODY_RESOLVE] fun setValue([BODY_RESOLVE] thisRef: R|kotlin/Any?|, [BODY_RESOLVE] property: R|kotlin/reflect/KProperty<*>|, [BODY_RESOLVE] value: R|kotlin/Int|): R|kotlin/Unit| {
}
}
public get(): R|kotlin/properties/ReadWriteProperty<kotlin/Any?, kotlin/Int>|
[IMPLICIT_TYPES_BODY_RESOLVE] public get(): R|kotlin/properties/ReadWriteProperty<kotlin/Any?, kotlin/Int>|
public final [STATUS] val valueWithExplicitType: R|kotlin/Int|by LAZY_EXPRESSION
public get(): <implicit> {
[STATUS] public get(): <implicit> {
^ D|/valueWithExplicitType|.getValue#(Null(null), ::R|/valueWithExplicitType|)
}
public final [IMPLICIT_TYPES_BODY_RESOLVE] val valueWithImplicitType: R|kotlin/Int|by R|/delegate|
public get(): R|kotlin/Int| {
[IMPLICIT_TYPES_BODY_RESOLVE] public get(): R|kotlin/Int| {
^ D|/valueWithImplicitType|.R|SubstitutionOverride<kotlin/properties/ReadWriteProperty.getValue: R|kotlin/Int|>|(Null(null), ::R|/valueWithImplicitType|)
}
public final [STATUS] var variableWithExplicitType: R|kotlin/Int|by LAZY_EXPRESSION
public get(): <implicit> {
[STATUS] public get(): <implicit> {
^ D|/variableWithExplicitType|.getValue#(Null(null), ::R|/variableWithExplicitType|)
}
public set(<set-?>: <implicit>): R|kotlin/Unit| {
[STATUS] public set([RAW_FIR] <set-?>: <implicit>): R|kotlin/Unit| {
D|/variableWithExplicitType|.setValue#(Null(null), ::R|/variableWithExplicitType|, R|<local>/variableWithExplicitType|)
}
public final [IMPLICIT_TYPES_BODY_RESOLVE] var variableWithImplicitType: R|kotlin/Int|by R|/delegate|
public get(): R|kotlin/Int| {
[IMPLICIT_TYPES_BODY_RESOLVE] public get(): R|kotlin/Int| {
^ D|/variableWithImplicitType|.R|SubstitutionOverride<kotlin/properties/ReadWriteProperty.getValue: R|kotlin/Int|>|(Null(null), ::R|/variableWithImplicitType|)
}
public set(<set-?>: R|kotlin/Int|): R|kotlin/Unit| {
[IMPLICIT_TYPES_BODY_RESOLVE] public set([IMPLICIT_TYPES_BODY_RESOLVE] <set-?>: R|kotlin/Int|): R|kotlin/Unit| {
D|/variableWithImplicitType|.R|SubstitutionOverride<kotlin/properties/ReadWriteProperty.setValue: R|kotlin/Unit|>|(Null(null), ::R|/variableWithImplicitType|, R|<local>/variableWithImplicitType|)
}
@@ -2,6 +2,6 @@ FILE: propertyWithGetter.kt
public final [BODY_RESOLVE] fun resolveMe(): R|kotlin/Unit| {
R|/receive|(R|/withGetter|)
}
public final [STATUS] fun receive(value: R|kotlin/Int|): R|kotlin/Unit| { LAZY_BLOCK }
public final [STATUS] fun receive([STATUS] value: R|kotlin/Int|): R|kotlin/Unit| { LAZY_BLOCK }
public final [STATUS] val withGetter: R|kotlin/Int|
public get(): R|kotlin/Int| { LAZY_BLOCK }
[STATUS] public get(): R|kotlin/Int| { LAZY_BLOCK }
@@ -3,7 +3,7 @@ FILE: propertyWithGetterAndSetter.kt
R|/receive|(R|/withGetterAndSetter|)
R|/withGetterAndSetter| = Int(123)
}
public final [STATUS] fun receive(value: R|kotlin/Int|): R|kotlin/Unit| { LAZY_BLOCK }
public final [STATUS] fun receive([STATUS] value: R|kotlin/Int|): R|kotlin/Unit| { LAZY_BLOCK }
public final [STATUS] var withGetterAndSetter: R|kotlin/Int| = LAZY_EXPRESSION
public get(): R|kotlin/Int| { LAZY_BLOCK }
public set(value: R|kotlin/Int|): R|kotlin/Unit| { LAZY_BLOCK }
[STATUS] public get(): R|kotlin/Int| { LAZY_BLOCK }
[STATUS] public set([RAW_FIR] value: R|kotlin/Int|): R|kotlin/Unit| { LAZY_BLOCK }
@@ -3,4 +3,4 @@ FILE: propertyWithInitializer.kt
<Unresolved name: receive>#(R|/property|)
}
public final [STATUS] val property: R|kotlin/Int| = LAZY_EXPRESSION
public get(): R|kotlin/Int|
[STATUS] public get(): R|kotlin/Int|
@@ -2,8 +2,8 @@ FILE: secondaryConstructor.kt
public final [BODY_RESOLVE] fun resolveMe(): R|kotlin/Unit| {
R|/receive|(R|/A.A|(Int(42)))
}
public final [STATUS] fun receive(value: R|A|): R|kotlin/Unit| { LAZY_BLOCK }
public final [STATUS] fun receive([STATUS] value: R|A|): R|kotlin/Unit| { LAZY_BLOCK }
public final [STATUS] class A : R|kotlin/Any| {
public [STATUS] constructor(x: R|kotlin/Int|): R|A| { LAZY_BLOCK }
public [STATUS] constructor([STATUS] x: R|kotlin/Int|): R|A| { LAZY_BLOCK }
}
@@ -2,5 +2,5 @@ FILE: topLevelFunctions.kt
public final [BODY_RESOLVE] fun resolveMe(): R|kotlin/Unit| {
R|/receive|(R|/functionWithLazyBody|())
}
public final [STATUS] fun receive(value: R|kotlin/String|): R|kotlin/Unit| { LAZY_BLOCK }
public final [STATUS] fun receive([STATUS] value: R|kotlin/String|): R|kotlin/Unit| { LAZY_BLOCK }
public final [STATUS] fun functionWithLazyBody(): R|kotlin/String| { LAZY_BLOCK }
@@ -2,5 +2,5 @@ FILE: topLevelFunctionsWithExpressionBodyAndExplicitType.kt
public final [BODY_RESOLVE] fun resolveMe(): R|kotlin/Unit| {
R|/receive|(R|/functionWithLazyBody|())
}
public final [STATUS] fun receive(value: R|kotlin/String|): R|kotlin/Unit| { LAZY_BLOCK }
public final [STATUS] fun receive([STATUS] value: R|kotlin/String|): R|kotlin/Unit| { LAZY_BLOCK }
public final [STATUS] fun functionWithLazyBody(): R|kotlin/String| { LAZY_BLOCK }
@@ -2,7 +2,7 @@ FILE: topLevelFunctionsWithImplicitType.kt
public final [BODY_RESOLVE] fun resolveMe(): R|kotlin/Unit| {
R|/receive|(R|/functionWithLazyBody|())
}
public final [STATUS] fun receive(value: R|kotlin/String|): R|kotlin/Unit| { LAZY_BLOCK }
public final [STATUS] fun receive([STATUS] value: R|kotlin/String|): R|kotlin/Unit| { LAZY_BLOCK }
public final [IMPLICIT_TYPES_BODY_RESOLVE] fun functionWithLazyBody(): R|kotlin/String| {
^functionWithLazyBody String(42)
}
+2 -2
View File
@@ -1,11 +1,11 @@
FILE: main.kt
public final [CONTRACTS] class WithElvis : R|kotlin/Any| {
public [CONTRACTS] constructor(value: R|kotlin/String?|): R|elvis/WithElvis| {
public [CONTRACTS] constructor([STATUS] value: R|kotlin/String?|): R|elvis/WithElvis| {
super<R|kotlin/Any|>()
}
public final [CONTRACTS] val value: R|kotlin/String?| = R|<local>/value|
public get(): R|kotlin/String?|
[STATUS] public get(): R|kotlin/String?|
public final [BODY_RESOLVE] fun foo(): R|kotlin/String| {
^foo this@R|elvis/WithElvis|.R|elvis/WithElvis.value| ?: String()
+1 -1
View File
@@ -5,7 +5,7 @@ FILE: main.kt
}
public final [BODY_RESOLVE] val x: R|kotlin/Int|
public get(): R|kotlin/Int|
[BODY_RESOLVE] public get(): R|kotlin/Int|
init {
this@R|/Foo|.R|/Foo.x| = Int(42)
+1 -1
View File
@@ -1,7 +1,7 @@
FILE: main.kt
public final [CONTRACTS] class Foo : R|kotlin/Any| {
public final [CONTRACTS] val x: R|kotlin/Int|
public get(): R|kotlin/Int|
[STATUS] public get(): R|kotlin/Int|
public [BODY_RESOLVE] constructor(): R|Foo| {
super<R|kotlin/Any|>()
+1 -1
View File
@@ -7,6 +7,6 @@ FILE: main.kt
public final [STATUS] fun foo(): R|kotlin/Unit| {
[RAW_FIR] lval y: <implicit> = Double(2.0)
}
public final [IMPLICIT_TYPES_BODY_RESOLVE] fun bar(x: R|kotlin/Int|, y: R|kotlin/Int|): R|kotlin/Int| {
public final [IMPLICIT_TYPES_BODY_RESOLVE] fun bar([IMPLICIT_TYPES_BODY_RESOLVE] x: R|kotlin/Int|, [IMPLICIT_TYPES_BODY_RESOLVE] y: R|kotlin/Int|): R|kotlin/Int| {
^bar R|<local>/x|.R|kotlin/Int.plus|(R|<local>/y|)
}
@@ -1,5 +1,5 @@
FILE: myProperty.kt
public final [IMPLICIT_TYPES_BODY_RESOLVE] val myProperty: R|kotlin/Int|
public get(): R|kotlin/Int| {
[IMPLICIT_TYPES_BODY_RESOLVE] public get(): R|kotlin/Int| {
^ Int(42)
}