[LL API] Support code fragment compilation

This commit is contained in:
Yan Zhulanow
2023-06-20 01:46:50 +09:00
committed by Space Team
parent 9446118d7f
commit e1db3c88cf
126 changed files with 2439 additions and 14 deletions
@@ -0,0 +1,4 @@
ContextReceiver[name: Foo; isMutated: false; displayText: this@Foo]
context(R|Foo|)
fun call(): R|kotlin/Unit|
R|Foo|
@@ -0,0 +1,13 @@
MODULE_FRAGMENT name:<Sources of main>
FILE fqName:<root> fileName:/fragment.kt
CLASS CLASS name:CodeFragment modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.CodeFragment
CONSTRUCTOR visibility:public <> () returnType:<root>.CodeFragment [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
FUN name:run visibility:public modality:FINAL <> (p0:<root>.Foo) returnType:kotlin.String
VALUE_PARAMETER name:p0 index:0 type:<root>.Foo
EXPRESSION_BODY
BLOCK type=kotlin.String origin=null
CALL 'public final fun <get-foo> (): kotlin.String declared in <root>.Foo' type=kotlin.String origin=GET_PROPERTY
$this: GET_VAR 'p0: <root>.Foo declared in <root>.CodeFragment.run' type=<root>.Foo origin=null
@@ -0,0 +1,12 @@
fun test() {
call(Foo())
}
context(Foo)
fun call() {
<caret>val x = 0
}
class Foo {
val foo: String = "foo"
}
@@ -0,0 +1,5 @@
public final class CodeFragment {
// source: 'fragment.kt'
public method <init>(): void
public final static method run(p0: Foo): java.lang.String
}
@@ -0,0 +1,4 @@
ContextReceiver[name: Foo; isMutated: false; displayText: this@Foo]
context(R|Foo|)
fun call(): R|kotlin/Unit|
R|Foo|
@@ -0,0 +1,13 @@
MODULE_FRAGMENT name:<Sources of main>
FILE fqName:<root> fileName:/fragment.kt
CLASS CLASS name:CodeFragment modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.CodeFragment
CONSTRUCTOR visibility:public <> () returnType:<root>.CodeFragment [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
FUN name:run visibility:public modality:FINAL <> (p0:<root>.Foo) returnType:kotlin.String
VALUE_PARAMETER name:p0 index:0 type:<root>.Foo
EXPRESSION_BODY
BLOCK type=kotlin.String origin=null
CALL 'public final fun <get-foo> (): kotlin.String declared in <root>.Foo' type=kotlin.String origin=GET_PROPERTY
$this: GET_VAR 'p0: <root>.Foo declared in <root>.CodeFragment.run' type=<root>.Foo origin=null
@@ -0,0 +1,12 @@
fun test() {
call(Foo())
}
context(Foo)
fun call() {
<caret>val x = 0
}
class Foo {
val foo: String = "foo"
}
@@ -0,0 +1,5 @@
public final class CodeFragment {
// source: 'fragment.kt'
public method <init>(): void
public final static method run(p0: Foo): java.lang.String
}
@@ -0,0 +1,6 @@
ExtensionReceiver[name: with; isMutated: false; displayText: this@with]
with@fun R|kotlin/String|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE>
R|kotlin/String|
ExtensionReceiver[name: with; isMutated: false; displayText: this@with]
with@fun R|Foo|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE>
R|Foo|
@@ -0,0 +1,18 @@
MODULE_FRAGMENT name:<Sources of main>
FILE fqName:<root> fileName:/fragment.kt
CLASS CLASS name:CodeFragment modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.CodeFragment
CONSTRUCTOR visibility:public <> () returnType:<root>.CodeFragment [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
FUN name:run visibility:public modality:FINAL <> (p0:kotlin.String, p1:<root>.Foo) returnType:kotlin.Int
VALUE_PARAMETER name:p0 index:0 type:kotlin.String
VALUE_PARAMETER name:p1 index:1 type:<root>.Foo
EXPRESSION_BODY
BLOCK type=kotlin.Int origin=null
CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS
$this: CALL 'public open fun <get-length> (): kotlin.Int declared in kotlin.String' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'p0: kotlin.String declared in <root>.CodeFragment.run' type=kotlin.String origin=null
other: CALL 'public open fun <get-length> (): kotlin.Int declared in kotlin.String' type=kotlin.Int origin=GET_PROPERTY
$this: CALL 'public final fun <get-foo> (): kotlin.String declared in <root>.Foo' type=kotlin.String origin=GET_PROPERTY
$this: GET_VAR 'p1: <root>.Foo declared in <root>.CodeFragment.run' type=<root>.Foo origin=null
@@ -0,0 +1,11 @@
fun test() {
with("Hello, world!") {
with(Foo()) {
<caret>val x = 0
}
}
}
class Foo {
val foo: String = "foo"
}
@@ -0,0 +1,5 @@
public final class CodeFragment {
// source: 'fragment.kt'
public method <init>(): void
public final static method run(p0: java.lang.String, p1: Foo): int
}
@@ -0,0 +1,3 @@
ExtensionReceiver[name: with; isMutated: false; displayText: this@with]
with@fun R|kotlin/String|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE>
R|kotlin/String|
@@ -0,0 +1,13 @@
MODULE_FRAGMENT name:<Sources of main>
FILE fqName:<root> fileName:/fragment.kt
CLASS CLASS name:CodeFragment modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.CodeFragment
CONSTRUCTOR visibility:public <> () returnType:<root>.CodeFragment [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
FUN name:run visibility:public modality:FINAL <> (p0:kotlin.String) returnType:kotlin.Int
VALUE_PARAMETER name:p0 index:0 type:kotlin.String
EXPRESSION_BODY
BLOCK type=kotlin.Int origin=null
CALL 'public open fun <get-length> (): kotlin.Int declared in kotlin.String' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'p0: kotlin.String declared in <root>.CodeFragment.run' type=kotlin.String origin=null
@@ -0,0 +1,5 @@
fun test() {
with("Hello, world!") {
<caret>val x = 0
}
}
@@ -0,0 +1,5 @@
public final class CodeFragment {
// source: 'fragment.kt'
public method <init>(): void
public final static method run(p0: java.lang.String): int
}
@@ -0,0 +1,3 @@
ExtensionReceiver[name: str; isMutated: false; displayText: this@str]
str@fun R|kotlin/String|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE>
R|kotlin/String|
@@ -0,0 +1,13 @@
MODULE_FRAGMENT name:<Sources of main>
FILE fqName:<root> fileName:/fragment.kt
CLASS CLASS name:CodeFragment modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.CodeFragment
CONSTRUCTOR visibility:public <> () returnType:<root>.CodeFragment [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
FUN name:run visibility:public modality:FINAL <> (p0:kotlin.String) returnType:kotlin.Int
VALUE_PARAMETER name:p0 index:0 type:kotlin.String
EXPRESSION_BODY
BLOCK type=kotlin.Int origin=null
CALL 'public open fun <get-length> (): kotlin.Int declared in kotlin.String' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'p0: kotlin.String declared in <root>.CodeFragment.run' type=kotlin.String origin=null
@@ -0,0 +1,5 @@
fun test() {
with("Hello, world!") str@{
<caret>val x = 0
}
}
@@ -0,0 +1,5 @@
public final class CodeFragment {
// source: 'fragment.kt'
public method <init>(): void
public final static method run(p0: java.lang.String): int
}
@@ -0,0 +1,6 @@
Local[name: a; isMutated: false; displayText: a]
a: R|kotlin/Int|
R|kotlin/Int|
Local[name: b; isMutated: false; displayText: b]
b: R|kotlin/String|
R|kotlin/String|
@@ -0,0 +1,16 @@
MODULE_FRAGMENT name:<Sources of main>
FILE fqName:<root> fileName:/fragment.kt
CLASS CLASS name:CodeFragment modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.CodeFragment
CONSTRUCTOR visibility:public <> () returnType:<root>.CodeFragment [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
FUN name:run visibility:public modality:FINAL <> (p0:kotlin.Int, p1:kotlin.String) returnType:kotlin.Int
VALUE_PARAMETER name:p0 index:0 type:kotlin.Int
VALUE_PARAMETER name:p1 index:1 type:kotlin.String
EXPRESSION_BODY
BLOCK type=kotlin.Int origin=null
CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS
$this: GET_VAR 'p0: kotlin.Int declared in <root>.CodeFragment.run' type=kotlin.Int origin=null
other: CALL 'public open fun <get-length> (): kotlin.Int declared in kotlin.String' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'p1: kotlin.String declared in <root>.CodeFragment.run' type=kotlin.String origin=null
@@ -0,0 +1,5 @@
class Foo(a: Int, b: String) {
init {
<caret>val x = 0
}
}
@@ -0,0 +1,5 @@
public final class CodeFragment {
// source: 'fragment.kt'
public method <init>(): void
public final static method run(p0: int, p1: java.lang.String): int
}
@@ -0,0 +1,3 @@
Local[name: x; isMutated: false; displayText: x]
lval x: R|kotlin/Int|
R|kotlin/Int|
@@ -0,0 +1,12 @@
MODULE_FRAGMENT name:<Sources of main>
FILE fqName:<root> fileName:/fragment.kt
CLASS CLASS name:CodeFragment modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.CodeFragment
CONSTRUCTOR visibility:public <> () returnType:<root>.CodeFragment [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
FUN name:run visibility:public modality:FINAL <> (p0:kotlin.Int) returnType:kotlin.Int
VALUE_PARAMETER name:p0 index:0 type:kotlin.Int
EXPRESSION_BODY
BLOCK type=kotlin.Int origin=null
GET_VAR 'p0: kotlin.Int declared in <root>.CodeFragment.run' type=kotlin.Int origin=null
@@ -0,0 +1,4 @@
fun test() {
val x = 0
<caret>val y = 0
}
@@ -0,0 +1,5 @@
public final class CodeFragment {
// source: 'fragment.kt'
public method <init>(): void
public final static method run(p0: int): int
}
@@ -0,0 +1,9 @@
LocalFunction[name: call; isMutated: false; displayText: call]
fun call(a: R|kotlin/Int|, b: R|kotlin/String|): R|kotlin/Unit|
R|(kotlin/Int, kotlin/String) -> kotlin/Unit|
Local[name: x; isMutated: false; displayText: x]
lval x: R|kotlin/Int|
R|kotlin/Int|
Local[name: y; isMutated: false; displayText: y]
lval y: R|kotlin/String|
R|kotlin/String|
@@ -0,0 +1,31 @@
MODULE_FRAGMENT name:<Sources of main>
FILE fqName:<root> fileName:/localFunction.kt
FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
FUN LOCAL_FUNCTION name:call visibility:local modality:FINAL <> (a:kotlin.Int, b:kotlin.String) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:kotlin.Int
VALUE_PARAMETER name:b index:1 type:kotlin.String
BLOCK_BODY
CALL 'public final fun println (message: kotlin.Any?): kotlin.Unit [inline] declared in kotlin.io' type=kotlin.Unit origin=null
message: CALL 'public final fun repeat (n: kotlin.Int): kotlin.String declared in kotlin.text' type=kotlin.String origin=null
$receiver: GET_VAR 'b: kotlin.String declared in <root>.test.call' type=kotlin.String origin=null
n: GET_VAR 'a: kotlin.Int declared in <root>.test.call' type=kotlin.Int origin=null
VAR name:x type:kotlin.Int [val]
CONST Int type=kotlin.Int value=2
VAR name:y type:kotlin.String [val]
CONST String type=kotlin.String value="foo"
VAR name:z type:kotlin.Unit [val]
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
FILE fqName:<root> fileName:/fragment.kt
CLASS CLASS name:CodeFragment modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.CodeFragment
CONSTRUCTOR visibility:public <> () returnType:<root>.CodeFragment [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
FUN name:run visibility:public modality:FINAL <> (p0:kotlin.Function2<kotlin.Int, kotlin.String, kotlin.Unit>, p1:kotlin.Int, p2:kotlin.String) returnType:kotlin.Unit
VALUE_PARAMETER name:p0 index:0 type:kotlin.Function2<kotlin.Int, kotlin.String, kotlin.Unit>
VALUE_PARAMETER name:p1 index:1 type:kotlin.Int
VALUE_PARAMETER name:p2 index:2 type:kotlin.String
EXPRESSION_BODY
BLOCK type=kotlin.Unit origin=null
GET_VAR 'p0: kotlin.Function2<kotlin.Int, kotlin.String, kotlin.Unit> declared in <root>.CodeFragment.run' type=kotlin.Function2<kotlin.Int, kotlin.String, kotlin.Unit> origin=null
@@ -0,0 +1,9 @@
fun test() {
fun call(a: Int, b: String) {
println(b.repeat(a))
}
val x = 2
val y = "foo"
<caret>val z = Unit
}
@@ -0,0 +1,7 @@
public final class CodeFragment {
// source: 'fragment.kt'
public method <init>(): void
public final static method run(p0: kotlin.jvm.functions.Function2, p1: int, p2: java.lang.String): void
}
public final class LocalFunctionKt
@@ -0,0 +1,3 @@
Local[name: x; isMutated: true; displayText: x]
lvar x: R|kotlin/Int|
R|kotlin/Int|
@@ -0,0 +1,13 @@
MODULE_FRAGMENT name:<Sources of main>
FILE fqName:<root> fileName:/fragment.kt
CLASS CLASS name:CodeFragment modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.CodeFragment
CONSTRUCTOR visibility:public <> () returnType:<root>.CodeFragment [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
FUN name:generated_for_debugger_fun visibility:public modality:FINAL <> (p0:kotlin.Int) returnType:kotlin.Unit
VALUE_PARAMETER SHARED_VARIABLE_IN_EVALUATOR_FRAGMENT name:p0 index:0 type:kotlin.Int [assignable]
EXPRESSION_BODY
BLOCK type=kotlin.Unit origin=null
SET_VAR 'p0: kotlin.Int [assignable] declared in <root>.CodeFragment.generated_for_debugger_fun' type=kotlin.Unit origin=null
CONST Int type=kotlin.Int value=1
@@ -0,0 +1,7 @@
fun test() {
var x = 0
<caret>val y = 0
}
// FragmentSharedVariablesLowering depends on a specific function name
// CODE_FRAGMENT_METHOD_NAME: generated_for_debugger_fun
@@ -0,0 +1,6 @@
public final class CodeFragment {
// source: 'fragment.kt'
public method <init>(): void
public final static method generated_for_debugger_fun(p0: kotlin.jvm.internal.Ref$IntRef): void
public final inner class kotlin/jvm/internal/Ref$IntRef
}
@@ -0,0 +1,6 @@
ContainingClass[name: <this>; isMutated: false; displayText: this@Foo]
class Foo : R|kotlin/Any|
R|Foo|
ContainingClass[name: <this>; isMutated: false; displayText: this@Bar]
class Bar : R|kotlin/Any|
R|Foo.Bar|
@@ -0,0 +1 @@
callFoo(this@Foo) + callString(a) + callString(b)
@@ -0,0 +1,22 @@
MODULE_FRAGMENT name:<Sources of main>
FILE fqName:<root> fileName:/fragment.kt
CLASS CLASS name:CodeFragment modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.CodeFragment
CONSTRUCTOR visibility:public <> () returnType:<root>.CodeFragment [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
FUN name:run visibility:public modality:FINAL <> (p0:<root>.Foo, p1:<root>.Foo.Bar) returnType:kotlin.Int
VALUE_PARAMETER name:p0 index:0 type:<root>.Foo
VALUE_PARAMETER name:p1 index:1 type:<root>.Foo.Bar
EXPRESSION_BODY
BLOCK type=kotlin.Int origin=null
CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS
$this: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS
$this: CALL 'public final fun callFoo (foo: <root>.Foo): kotlin.Int declared in <root>.NestedOuterClassKt' type=kotlin.Int origin=null
foo: GET_VAR 'p0: <root>.Foo declared in <root>.CodeFragment.run' type=<root>.Foo origin=null
other: CALL 'public final fun callString (string: kotlin.String): kotlin.Int declared in <root>.NestedOuterClassKt' type=kotlin.Int origin=null
string: CALL 'private final fun <get-a> (): kotlin.String declared in <root>.Foo' type=kotlin.String origin=GET_PROPERTY
$this: GET_VAR 'p0: <root>.Foo declared in <root>.CodeFragment.run' type=<root>.Foo origin=null
other: CALL 'public final fun callString (string: kotlin.String): kotlin.Int declared in <root>.NestedOuterClassKt' type=kotlin.Int origin=null
string: CALL 'private final fun <get-b> (): kotlin.String declared in <root>.Foo.Bar' type=kotlin.String origin=GET_PROPERTY
$this: GET_VAR 'p1: <root>.Foo.Bar declared in <root>.CodeFragment.run' type=<root>.Foo.Bar origin=null
@@ -0,0 +1,19 @@
class Foo {
private val a: String = "foo"
inner class Bar {
private val b: String = "bar"
fun test() {
<caret>val x = 0
}
}
}
fun callFoo(foo: Foo): Int {
return 0
}
fun callString(string: String): Int {
return 1
}
@@ -0,0 +1,6 @@
public final class CodeFragment {
// source: 'fragment.kt'
public method <init>(): void
public final static method run(p0: Foo, p1: Foo$Bar): int
public final inner class Foo$Bar
}
@@ -0,0 +1,12 @@
MODULE_FRAGMENT name:<Sources of main>
FILE fqName:<root> fileName:/fragment.kt
CLASS CLASS name:CodeFragment modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.CodeFragment
CONSTRUCTOR visibility:public <> () returnType:<root>.CodeFragment [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
FUN name:run visibility:public modality:FINAL <> () returnType:kotlin.Unit
EXPRESSION_BODY
BLOCK type=kotlin.Unit origin=null
CALL 'public final fun call (): kotlin.Unit declared in <root>.Foo' type=kotlin.Unit origin=null
$this: GET_OBJECT 'CLASS OBJECT name:Foo modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.Foo
@@ -0,0 +1,7 @@
object Foo {
fun test() {
<caret>val x = 0
}
fun call() {}
}
@@ -0,0 +1,5 @@
public final class CodeFragment {
// source: 'fragment.kt'
public method <init>(): void
public final static method run(): void
}
@@ -0,0 +1,3 @@
ContainingClass[name: <this>; isMutated: false; displayText: this@Test]
class Test : R|kotlin/Any|
R|Test|
@@ -0,0 +1,14 @@
MODULE_FRAGMENT name:<Sources of main>
FILE fqName:<root> fileName:/fragment.kt
CLASS CLASS name:CodeFragment modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.CodeFragment
CONSTRUCTOR visibility:public <> () returnType:<root>.CodeFragment [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
FUN name:run visibility:public modality:FINAL <> (p0:<root>.Test) returnType:kotlin.Int
VALUE_PARAMETER name:p0 index:0 type:<root>.Test
EXPRESSION_BODY
BLOCK type=kotlin.Int origin=null
CALL 'public open fun <get-length> (): kotlin.Int declared in kotlin.String' type=kotlin.Int origin=GET_PROPERTY
$this: CALL 'public final fun <get-a> (): kotlin.String declared in <root>.Test' type=kotlin.String origin=GET_PROPERTY
$this: GET_VAR 'p0: <root>.Test declared in <root>.CodeFragment.run' type=<root>.Test origin=null
@@ -0,0 +1,7 @@
class Test {
val a: String = "foo"
fun test() {
<caret>val x = 0
}
}
@@ -0,0 +1,5 @@
public final class CodeFragment {
// source: 'fragment.kt'
public method <init>(): void
public final static method run(p0: Test): int
}
@@ -0,0 +1,3 @@
ContainingClass[name: <this>; isMutated: false; displayText: this@Test]
class Test : R|kotlin/Any|
R|Test|
@@ -0,0 +1,14 @@
MODULE_FRAGMENT name:<Sources of main>
FILE fqName:<root> fileName:/fragment.kt
CLASS CLASS name:CodeFragment modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.CodeFragment
CONSTRUCTOR visibility:public <> () returnType:<root>.CodeFragment [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
FUN name:run visibility:public modality:FINAL <> (p0:<root>.Test) returnType:kotlin.Unit
VALUE_PARAMETER name:p0 index:0 type:<root>.Test
EXPRESSION_BODY
BLOCK type=kotlin.Unit origin=null
CALL 'public final fun <set-a> (value: kotlin.String): kotlin.Unit declared in <root>.Test' type=kotlin.Unit origin=EQ
$this: GET_VAR 'p0: <root>.Test declared in <root>.CodeFragment.run' type=<root>.Test origin=null
value: CONST String type=kotlin.String value="bar"
@@ -0,0 +1,7 @@
class Test {
var a: String = "foo"
fun test() {
<caret>val x = 0
}
}
@@ -0,0 +1,5 @@
public final class CodeFragment {
// source: 'fragment.kt'
public method <init>(): void
public final static method run(p0: Test): void
}
@@ -0,0 +1,3 @@
ContainingClass[name: <this>; isMutated: false; displayText: this@Test]
class Test : R|kotlin/Any|
R|Test|
@@ -0,0 +1,14 @@
MODULE_FRAGMENT name:<Sources of main>
FILE fqName:<root> fileName:/fragment.kt
CLASS CLASS name:CodeFragment modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.CodeFragment
CONSTRUCTOR visibility:public <> () returnType:<root>.CodeFragment [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
FUN name:run visibility:public modality:FINAL <> (p0:<root>.Test) returnType:kotlin.Unit
VALUE_PARAMETER name:p0 index:0 type:<root>.Test
EXPRESSION_BODY
BLOCK type=kotlin.Unit origin=null
CALL 'private final fun <set-a> (value: kotlin.String): kotlin.Unit declared in <root>.Test' type=kotlin.Unit origin=EQ
$this: GET_VAR 'p0: <root>.Test declared in <root>.CodeFragment.run' type=<root>.Test origin=null
value: CONST String type=kotlin.String value="bar"
@@ -0,0 +1,7 @@
class Test {
private var a: String = "foo"
fun test() {
<caret>val x = 0
}
}
@@ -0,0 +1,5 @@
public final class CodeFragment {
// source: 'fragment.kt'
public method <init>(): void
public final static method run(p0: Test): void
}
@@ -0,0 +1,3 @@
Local[name: foo; isMutated: false; displayText: foo]
foo: R|Foo?|
R|Foo?|
@@ -0,0 +1,24 @@
MODULE_FRAGMENT name:<Sources of main>
FILE fqName:<root> fileName:/fragment.kt
CLASS CLASS name:CodeFragment modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.CodeFragment
CONSTRUCTOR visibility:public <> () returnType:<root>.CodeFragment [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
FUN name:run visibility:public modality:FINAL <> (p0:<root>.Foo?) returnType:kotlin.Unit?
VALUE_PARAMETER name:p0 index:0 type:<root>.Foo?
EXPRESSION_BODY
BLOCK type=kotlin.Unit? origin=null
BLOCK type=kotlin.Unit? origin=SAFE_CALL
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:<root>.Foo? [val]
GET_VAR 'p0: <root>.Foo? declared in <root>.CodeFragment.run' type=<root>.Foo? origin=null
WHEN type=kotlin.Unit? origin=null
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'val tmp_0: <root>.Foo? [val] declared in <root>.CodeFragment.run' type=<root>.Foo? origin=null
arg1: CONST Null type=kotlin.Nothing? value=null
then: CONST Null type=kotlin.Nothing? value=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun call (): kotlin.Unit declared in <root>.Foo' type=kotlin.Unit origin=null
$this: GET_VAR 'val tmp_0: <root>.Foo? [val] declared in <root>.CodeFragment.run' type=<root>.Foo? origin=null
@@ -0,0 +1,7 @@
fun test(foo: Foo?) {
<caret>val x = 0
}
class Foo {
fun call() {}
}
@@ -0,0 +1,5 @@
public final class CodeFragment {
// source: 'fragment.kt'
public method <init>(): void
public final static method run(p0: Foo): kotlin.Unit
}
@@ -0,0 +1,11 @@
MODULE_FRAGMENT name:<Sources of main>
FILE fqName:<root> fileName:/fragment.kt
CLASS CLASS name:MyCodeFragment modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MyCodeFragment
CONSTRUCTOR visibility:public <> () returnType:<root>.MyCodeFragment [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
FUN name:invoke visibility:public modality:FINAL <> () returnType:kotlin.String
EXPRESSION_BODY
BLOCK type=kotlin.String origin=null
CONST String type=kotlin.String value="foo"
@@ -0,0 +1,6 @@
fun test() {
<caret>val x = 0
}
// CODE_FRAGMENT_CLASS_NAME: MyCodeFragment
// CODE_FRAGMENT_METHOD_NAME: invoke
@@ -0,0 +1,5 @@
public final class MyCodeFragment {
// source: 'fragment.kt'
public method <init>(): void
public final static method invoke(): java.lang.String
}
@@ -0,0 +1 @@
TreeSet(File("foo").readLines())
@@ -0,0 +1,15 @@
MODULE_FRAGMENT name:<Sources of main>
FILE fqName:<root> fileName:/fragment.kt
CLASS CLASS name:CodeFragment modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.CodeFragment
CONSTRUCTOR visibility:public <> () returnType:<root>.CodeFragment [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
FUN name:run visibility:public modality:FINAL <> () returnType:java.util.TreeSet<@[FlexibleNullability] kotlin.String?>
EXPRESSION_BODY
BLOCK type=java.util.TreeSet<@[FlexibleNullability] kotlin.String?> origin=null
CONSTRUCTOR_CALL 'public constructor <init> (p0: @[FlexibleNullability] @[FlexibleMutability] kotlin.collections.MutableCollection<out @[FlexibleNullability] E of java.util.TreeSet?>?) declared in java.util.TreeSet' type=java.util.TreeSet<@[FlexibleNullability] kotlin.String?> origin=null
<class: E>: @[FlexibleNullability] kotlin.String?
p0: CALL 'public final fun readLines (charset: java.nio.charset.Charset): kotlin.collections.List<kotlin.String> declared in kotlin.io' type=kotlin.collections.List<kotlin.String> origin=null
$receiver: CONSTRUCTOR_CALL 'public constructor <init> (p0: @[FlexibleNullability] kotlin.String?) declared in java.io.File' type=java.io.File origin=null
p0: CONST String type=kotlin.String value="foo"
@@ -0,0 +1,7 @@
import java.util.TreeSet
fun test() {
<caret>val x = 0
}
// CODE_FRAGMENT_IMPORT: java.io.File
@@ -0,0 +1,5 @@
public final class CodeFragment {
// source: 'fragment.kt'
public method <init>(): void
public final static method run(): java.util.TreeSet
}
@@ -0,0 +1,4 @@
listOf(1, 2, 3, 4, 5)
.filter { (it % 2) == 0 }
.map { it * 2 }
.forEach { System.out.println(it) }
@@ -0,0 +1,50 @@
MODULE_FRAGMENT name:<Sources of main>
FILE fqName:<root> fileName:/fragment.kt
CLASS CLASS name:CodeFragment modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.CodeFragment
CONSTRUCTOR visibility:public <> () returnType:<root>.CodeFragment [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
FUN name:run visibility:public modality:FINAL <> () returnType:kotlin.Unit
EXPRESSION_BODY
BLOCK type=kotlin.Unit origin=null
CALL 'public final fun forEach <T> (action: kotlin.Function1<T of kotlin.collections.forEach, kotlin.Unit>): kotlin.Unit [inline] declared in kotlin.collections' type=kotlin.Unit origin=null
<T>: kotlin.Int
$receiver: CALL 'public final fun map <T, R> (transform: kotlin.Function1<T of kotlin.collections.map, R of kotlin.collections.map>): kotlin.collections.List<R of kotlin.collections.map> [inline] declared in kotlin.collections' type=kotlin.collections.List<kotlin.Int> origin=null
<T>: kotlin.Int
<R>: kotlin.Int
$receiver: CALL 'public final fun filter <T> (predicate: kotlin.Function1<T of kotlin.collections.filter, kotlin.Boolean>): kotlin.collections.List<T of kotlin.collections.filter> [inline] declared in kotlin.collections' type=kotlin.collections.List<kotlin.Int> origin=null
<T>: kotlin.Int
$receiver: CALL 'public final fun listOf <T> (vararg elements: T of kotlin.collections.listOf): kotlin.collections.List<T of kotlin.collections.listOf> declared in kotlin.collections' type=kotlin.collections.List<kotlin.Int> origin=null
<T>: kotlin.Int
elements: VARARG type=kotlin.Array<out kotlin.Int> varargElementType=kotlin.Int
CONST Int type=kotlin.Int value=1
CONST Int type=kotlin.Int value=2
CONST Int type=kotlin.Int value=3
CONST Int type=kotlin.Int value=4
CONST Int type=kotlin.Int value=5
predicate: FUN_EXPR type=kotlin.Function1<kotlin.Int, kotlin.Boolean> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:kotlin.Int) returnType:kotlin.Boolean
VALUE_PARAMETER name:it index:0 type:kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: kotlin.Int): kotlin.Boolean declared in <root>.CodeFragment.run'
CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: CALL 'public final fun rem (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PERC
$this: GET_VAR 'it: kotlin.Int declared in <root>.CodeFragment.run.<anonymous>' type=kotlin.Int origin=null
other: CONST Int type=kotlin.Int value=2
arg1: CONST Int type=kotlin.Int value=0
transform: FUN_EXPR type=kotlin.Function1<kotlin.Int, kotlin.Int> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:kotlin.Int) returnType:kotlin.Int
VALUE_PARAMETER name:it index:0 type:kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: kotlin.Int): kotlin.Int declared in <root>.CodeFragment.run'
CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=MUL
$this: GET_VAR 'it: kotlin.Int declared in <root>.CodeFragment.run.<anonymous>' type=kotlin.Int origin=null
other: CONST Int type=kotlin.Int value=2
action: FUN_EXPR type=kotlin.Function1<kotlin.Int, kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:kotlin.Int) returnType:kotlin.Unit
VALUE_PARAMETER name:it index:0 type:kotlin.Int
BLOCK_BODY
CALL 'public open fun println (p0: kotlin.Int): kotlin.Unit declared in java.io.PrintStream' type=kotlin.Unit origin=null
$this: GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:out type:@[FlexibleNullability] java.io.PrintStream? visibility:public [final,static]' type=@[FlexibleNullability] java.io.PrintStream? origin=GET_PROPERTY
p0: GET_VAR 'it: kotlin.Int declared in <root>.CodeFragment.run.<anonymous>' type=kotlin.Int origin=null
@@ -0,0 +1,3 @@
fun test() {
<caret>val x = 0
}
@@ -0,0 +1,5 @@
public final class CodeFragment {
// source: 'fragment.kt'
public method <init>(): void
public final static method run(): void
}
@@ -0,0 +1,32 @@
MODULE_FRAGMENT name:<Sources of main>
FILE fqName:<root> fileName:/inlineFunctionUsageSource.kt
FUN name:call visibility:public modality:FINAL <> (block:kotlin.Function1<kotlin.Int, kotlin.Int>) returnType:kotlin.Unit [inline]
VALUE_PARAMETER name:block index:0 type:kotlin.Function1<kotlin.Int, kotlin.Int>
BLOCK_BODY
CALL 'public open fun println (p0: kotlin.Int): kotlin.Unit declared in java.io.PrintStream' type=kotlin.Unit origin=null
$this: GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:out type:@[FlexibleNullability] java.io.PrintStream? visibility:public [final,static]' type=@[FlexibleNullability] java.io.PrintStream? origin=GET_PROPERTY
p0: CALL 'public abstract fun invoke (p1: P1 of kotlin.Function1): R of kotlin.Function1 [operator] declared in kotlin.Function1' type=kotlin.Int origin=INVOKE
$this: GET_VAR 'block: kotlin.Function1<kotlin.Int, kotlin.Int> declared in <root>.call' type=kotlin.Function1<kotlin.Int, kotlin.Int> origin=VARIABLE_AS_FUNCTION
p1: CONST Int type=kotlin.Int value=5
FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
VAR name:x type:kotlin.Int [val]
CONST Int type=kotlin.Int value=0
FILE fqName:<root> fileName:/fragment.kt
CLASS CLASS name:CodeFragment modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.CodeFragment
CONSTRUCTOR visibility:public <> () returnType:<root>.CodeFragment [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
FUN name:run visibility:public modality:FINAL <> () returnType:kotlin.Unit
EXPRESSION_BODY
BLOCK type=kotlin.Unit origin=null
CALL 'public final fun call (block: kotlin.Function1<kotlin.Int, kotlin.Int>): kotlin.Unit [inline] declared in <root>' type=kotlin.Unit origin=null
block: FUN_EXPR type=kotlin.Function1<kotlin.Int, kotlin.Int> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:kotlin.Int) returnType:kotlin.Int
VALUE_PARAMETER name:it index:0 type:kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: kotlin.Int): kotlin.Int declared in <root>.CodeFragment.run'
CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=MUL
$this: GET_VAR 'it: kotlin.Int declared in <root>.CodeFragment.run.<anonymous>' type=kotlin.Int origin=null
other: CONST Int type=kotlin.Int value=2
@@ -0,0 +1,7 @@
fun test() {
<caret>val x = 0
}
inline fun call(block: (Int) -> Int) {
System.out.println(block(5))
}
@@ -0,0 +1,7 @@
public final class CodeFragment {
// source: 'fragment.kt'
public method <init>(): void
public final static method run(): void
}
public final class InlineFunctionUsageSourceKt
@@ -0,0 +1,15 @@
MODULE_FRAGMENT name:<Sources of main>
FILE fqName:<root> fileName:/fragment.kt
CLASS CLASS name:CodeFragment modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.CodeFragment
CONSTRUCTOR visibility:public <> () returnType:<root>.CodeFragment [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
FUN name:run visibility:public modality:FINAL <> () returnType:kotlin.Int
EXPRESSION_BODY
BLOCK type=kotlin.Int origin=null
VAR name:a type:kotlin.Int [val]
CONST Int type=kotlin.Int value=5
CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=MUL
$this: GET_VAR 'val a: kotlin.Int [val] declared in <root>.CodeFragment.run' type=kotlin.Int origin=null
other: CONST Int type=kotlin.Int value=2
@@ -0,0 +1,3 @@
fun foo() {
<caret>val x = 0
}
@@ -0,0 +1,5 @@
public final class CodeFragment {
// source: 'fragment.kt'
public method <init>(): void
public final static method run(): int
}
@@ -0,0 +1,15 @@
MODULE_FRAGMENT name:<Sources of main>
FILE fqName:<root> fileName:/fragment.kt
CLASS CLASS name:CodeFragment modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.CodeFragment
CONSTRUCTOR visibility:public <> () returnType:<root>.CodeFragment [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
FUN name:run visibility:public modality:FINAL <> () returnType:kotlin.Int
EXPRESSION_BODY
BLOCK type=kotlin.Int origin=null
CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS
$this: CONST Int type=kotlin.Int value=2
other: CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=MUL
$this: CONST Int type=kotlin.Int value=2
other: CONST Int type=kotlin.Int value=2
@@ -0,0 +1,3 @@
fun test() {
<caret>val x = 0
}
@@ -0,0 +1,5 @@
public final class CodeFragment {
// source: 'fragment.kt'
public method <init>(): void
public final static method run(): int
}