[IR] Add body printing strategy to Kotlin-like dumper

This commit is contained in:
Sergej Jaskiewicz
2023-05-01 18:55:42 +02:00
committed by Space Team
parent ca8af7786e
commit 89ff7bd0db
36 changed files with 165 additions and 39 deletions
@@ -6,6 +6,7 @@ abstract class AbstractClass {
}
abstract fun abstractFun()
abstract val abstractVal: Int
abstract get
@@ -17,6 +18,7 @@ abstract class AbstractClass {
interface Interface {
abstract fun abstractFun()
abstract val abstractVal: Int
abstract get
@@ -62,6 +62,7 @@ class C {
interface NestedInterface {
abstract fun foo()
fun bar() {
return <this>.foo()
}
@@ -1,5 +1,6 @@
interface IBase<A : Any?> {
abstract fun <B : Any?> foo(a: A, b: B)
abstract val <C : Any?> C.id: Map<A, C>?
abstract get
@@ -1,5 +1,6 @@
interface IBase<A : Any?> {
abstract fun <B : Any?> foo(a: A, b: B)
abstract val <C : Any?> C.id: Map<A, C>?
abstract get
@@ -1,6 +1,8 @@
interface IBase {
abstract fun foo(x: Int, s: String)
abstract fun bar(): Int
abstract fun String.qux()
}
@@ -1,6 +1,8 @@
interface IBase {
abstract fun foo(x: Int, s: String)
abstract fun bar(): Int
abstract fun String.qux()
}
@@ -1,5 +1,6 @@
interface IFooBar {
abstract fun foo()
abstract fun bar()
}
@@ -1,5 +1,6 @@
interface IFooBar {
abstract fun foo()
abstract fun bar()
}
+2
View File
@@ -66,6 +66,7 @@ abstract enum class TestEnum3 : Enum<TestEnum3> {
}
abstract fun foo()
fun values(): Array<TestEnum3> /* Synthetic body for ENUM_VALUES */
fun valueOf(value: String): TestEnum3 /* Synthetic body for ENUM_VALUEOF */
@@ -122,6 +123,7 @@ abstract enum class TestEnum4 : Enum<TestEnum4> {
}
abstract fun foo()
fun values(): Array<TestEnum4> /* Synthetic body for ENUM_VALUES */
fun valueOf(value: String): TestEnum4 /* Synthetic body for ENUM_VALUEOF */
@@ -142,6 +142,7 @@ abstract enum class TestAbstractEnum1 : Enum<TestAbstractEnum1> {
}
abstract fun foo()
fun values(): Array<TestAbstractEnum1> /* Synthetic body for ENUM_VALUES */
fun valueOf(value: String): TestAbstractEnum1 /* Synthetic body for ENUM_VALUEOF */
@@ -96,6 +96,7 @@ abstract enum class Test2 : Enum<Test2> {
}
abstract fun foo()
fun values(): Array<Test2> /* Synthetic body for ENUM_VALUES */
fun valueOf(value: String): Test2 /* Synthetic body for ENUM_VALUEOF */
@@ -16,6 +16,7 @@ open class Base {
interface BaseI {
abstract fun foo()
abstract val bar: String
abstract get
@@ -14,6 +14,7 @@ interface IFoo {
@Ann
abstract fun testFun()
@Ann
abstract val String.testExtVal: String
abstract get
@@ -14,6 +14,7 @@ interface IFoo {
@Ann
abstract fun testFun()
@Ann
abstract val String.testExtVal: String
abstract get
@@ -7,6 +7,7 @@ fun outer() {
}
abstract fun afun()
abstract val aval: Int
abstract get
@@ -7,6 +7,7 @@ expect abstract class A {
expect open class B : A {
expect constructor(i: Int) /* primary */
expect override fun foo()
expect open fun bar(s: String)
}
@@ -1,5 +1,6 @@
interface IBase<T : Any?> {
abstract fun foo(x: Int)
abstract val bar: Int
abstract get
@@ -1,5 +1,6 @@
interface IBase<T : Any?> {
abstract fun foo(x: Int)
abstract val bar: Int
abstract get
@@ -1,5 +1,6 @@
interface IFoo {
abstract fun foo()
fun bar() {
<this>.foo()
}
@@ -1,5 +1,6 @@
interface Visitor {
abstract fun visit()
fun visitArray(): Visitor? {
return null
}
@@ -1,5 +1,6 @@
interface Visitor {
abstract fun visit()
fun visitArray(): Visitor? {
return null
}
@@ -9,7 +9,9 @@ sealed class ArrayMap<T : Any> : Iterable<T> {
abstract get
abstract operator fun set(index: Int, value: T)
abstract operator fun get(index: Int): T?
abstract fun copy(): ArrayMap<T>
}
@@ -9,7 +9,9 @@ sealed class ArrayMap<T : Any> : Iterable<T> {
abstract get
abstract operator fun set(index: Int, value: T)
abstract operator fun get(index: Int): T?
abstract fun copy(): ArrayMap<T>
}
@@ -4,7 +4,9 @@ interface IrType {
interface TypeRemapper {
abstract fun enterScope(irTypeParametersContainer: IrTypeParametersContainer)
abstract fun remapType(type: IrType): IrType
abstract fun leaveScope()
}
@@ -4,7 +4,9 @@ interface IrType {
interface TypeRemapper {
abstract fun enterScope(irTypeParametersContainer: IrTypeParametersContainer)
abstract fun remapType(type: IrType): IrType
abstract fun leaveScope()
}
@@ -13,6 +13,7 @@ abstract class Base<T : Any?> {
get
abstract fun <Y : Any?> foo(y: Y): T
abstract var bar: T
abstract get
abstract set
@@ -13,6 +13,7 @@ abstract class Base<T : Any?> {
get
abstract fun <Y : Any?> foo(y: Y): T
abstract var bar: T
abstract get
abstract set
@@ -1,5 +1,6 @@
interface B<T1 : Any?> : A<T1> {
abstract override fun foo(x: T1): T1
abstract override fun bar(x: (T1 & Any)): (T1 & Any)
}
@@ -1,5 +1,6 @@
interface B<T1 : Any?> : A<T1> {
abstract override fun foo(x: T1): T1
abstract override fun bar(x: (T1 & Any)): (T1 & Any)
}
@@ -1,5 +1,6 @@
interface I<T : Any?> {
abstract fun input(t: T)
abstract fun output(): T
}
@@ -1,5 +1,6 @@
interface I<T : Any?> {
abstract fun input(t: T)
abstract fun output(): T
}
@@ -22,6 +22,7 @@ abstract class Box<T> : IFoo, IBar where T : IFoo, T : IBar {
}
abstract fun <F> foo(tSerializer: I<F>): I<Box<F>> where F : IFoo, F : IBar
fun bar(vararg serializers: I<*>): I<*> {
return <this>.foo<IFoo>(tSerializer = serializers.get(index = 0))
}
@@ -22,6 +22,7 @@ abstract class Box<T> : IFoo, IBar where T : IFoo, T : IBar {
}
abstract fun <F> foo(tSerializer: I<F>): I<Box<F>> where F : IFoo, F : IBar
fun bar(vararg serializers: I<*>): I<*> {
return <this>.foo<IBase>(tSerializer = serializers.get(index = 0))
}
@@ -1,7 +1,10 @@
interface K {
abstract fun kf1(): Collection<out CharSequence>
abstract fun kf2(): Collection<CharSequence>
abstract fun kg1(c: Collection<out CharSequence>)
abstract fun kg2(c: Collection<CharSequence>)
}
@@ -1,7 +1,10 @@
interface K {
abstract fun kf1(): Collection<out CharSequence>
abstract fun kf2(): Collection<CharSequence>
abstract fun kg1(c: Collection<out CharSequence>)
abstract fun kg2(c: Collection<CharSequence>)
}