[FIR] Don't render lambda bodies in arguments of calls in cfg dump
This commit is contained in:
+12
-7
@@ -157,20 +157,25 @@ private fun CFGNode<*>.render(): String =
|
||||
is LoopConditionExitNode -> "Exit loop condition"
|
||||
is LoopExitNode -> "Exit ${fir.type()}loop"
|
||||
|
||||
is QualifiedAccessNode -> "Access variable ${fir.calleeReference.render()}"
|
||||
is QualifiedAccessNode -> "Access variable ${fir.calleeReference.render(FirRenderer.RenderMode.DontRenderLambdaBodies)}"
|
||||
is OperatorCallNode -> "Operator ${fir.operation.operator}"
|
||||
is TypeOperatorCallNode -> "Type operator: \"${fir.render()}\""
|
||||
is TypeOperatorCallNode -> "Type operator: \"${fir.render(FirRenderer.RenderMode.DontRenderLambdaBodies)}\""
|
||||
is JumpNode -> "Jump: ${fir.render()}"
|
||||
is StubNode -> "Stub"
|
||||
is CheckNotNullCallNode -> "Check not null: ${fir.render()}"
|
||||
is CheckNotNullCallNode -> "Check not null: ${fir.render(FirRenderer.RenderMode.DontRenderLambdaBodies)}"
|
||||
|
||||
is ConstExpressionNode -> "Const: ${fir.render()}"
|
||||
is VariableDeclarationNode ->
|
||||
"Variable declaration: ${buildString { FirRenderer(this).visitCallableDeclaration(fir) }}"
|
||||
"Variable declaration: ${buildString {
|
||||
FirRenderer(
|
||||
this,
|
||||
FirRenderer.RenderMode.DontRenderLambdaBodies
|
||||
).visitCallableDeclaration(fir)
|
||||
}}"
|
||||
|
||||
is VariableAssignmentNode -> "Assignmenet: ${fir.lValue.render()}"
|
||||
is FunctionCallNode -> "Function call: ${fir.render()}"
|
||||
is ThrowExceptionNode -> "Throw: ${fir.render()}"
|
||||
is VariableAssignmentNode -> "Assignmenet: ${fir.lValue.render(FirRenderer.RenderMode.DontRenderLambdaBodies)}"
|
||||
is FunctionCallNode -> "Function call: ${fir.render(FirRenderer.RenderMode.DontRenderLambdaBodies)}"
|
||||
is ThrowExceptionNode -> "Throw: ${fir.render(FirRenderer.RenderMode.DontRenderLambdaBodies)}"
|
||||
|
||||
is TryExpressionEnterNode -> "Try expression enter"
|
||||
is TryMainBlockEnterNode -> "Try main block enter"
|
||||
|
||||
+1
-4
@@ -343,10 +343,7 @@ digraph jumps_kt {
|
||||
117 [label="Exit function anonymousFunction"];
|
||||
}
|
||||
118 [label="Postponed exit from lambda"];
|
||||
119 [label="Function call: R|/run|(<L> = run@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> {
|
||||
^@run Unit
|
||||
}
|
||||
)"];
|
||||
119 [label="Function call: R|/run|(<L> = run@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> )"];
|
||||
120 [label="Exit function test_6" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
|
||||
+3
-12
@@ -40,10 +40,7 @@ digraph lambdas_kt {
|
||||
16 [label="Exit function anonymousFunction"];
|
||||
}
|
||||
17 [label="Postponed exit from lambda"];
|
||||
18 [label="Function call: R|/run|(<L> = run@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> {
|
||||
^ R|<local>/x|.R|kotlin/Int.inc|()
|
||||
}
|
||||
)"];
|
||||
18 [label="Function call: R|/run|(<L> = run@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> )"];
|
||||
19 [label="Exit block"];
|
||||
}
|
||||
20 [label="Exit when branch result"];
|
||||
@@ -157,10 +154,7 @@ digraph lambdas_kt {
|
||||
53 [label="Exit function anonymousFunction"];
|
||||
}
|
||||
54 [label="Postponed exit from lambda"];
|
||||
55 [label="Function call: R|/getInt|(<L> = getInt@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> {
|
||||
^test_3 Int(1)
|
||||
}
|
||||
)"];
|
||||
55 [label="Function call: R|/getInt|(<L> = getInt@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> )"];
|
||||
56 [label="Jump: ^test_3 R|/getInt|(<L> = getInt@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> {
|
||||
^test_3 Int(1)
|
||||
}
|
||||
@@ -198,10 +192,7 @@ digraph lambdas_kt {
|
||||
65 [label="Exit function anonymousFunction"];
|
||||
}
|
||||
66 [label="Postponed exit from lambda"];
|
||||
67 [label="Function call: R|/getInt|(block = getInt@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> {
|
||||
^test_4 Int(1)
|
||||
}
|
||||
)"];
|
||||
67 [label="Function call: R|/getInt|(block = getInt@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> )"];
|
||||
68 [label="Jump: ^test_4 R|/getInt|(block = getInt@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> {
|
||||
^test_4 Int(1)
|
||||
}
|
||||
|
||||
@@ -24,10 +24,7 @@ digraph postponedLambdas_kt {
|
||||
}
|
||||
8 [label="Postponed exit from lambda"];
|
||||
9 [label="Access variable R|<local>/b|"];
|
||||
10 [label="Function call: R|/foo|(vararg(R|<local>/a|, foo@fun <anonymous>(): R|kotlin/String| <kind=UNKNOWN> {
|
||||
^ String()
|
||||
}
|
||||
, R|<local>/b|))"];
|
||||
10 [label="Function call: R|/foo|(vararg(R|<local>/a|, foo@fun <anonymous>(): R|kotlin/String| <kind=UNKNOWN> , R|<local>/b|))"];
|
||||
11 [label="Exit function test" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
|
||||
@@ -128,27 +128,7 @@ digraph propertiesAndInitBlocks_kt {
|
||||
41 [label="Exit function anonymousFunction"];
|
||||
}
|
||||
42 [label="Postponed exit from lambda"];
|
||||
43 [label="Function call: R|/run|(<L> = run@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> {
|
||||
local final fun foo(): R|kotlin/Unit| {
|
||||
lval c: R|kotlin/Int| = Int(1).R|kotlin/Int.plus|(Int(1))
|
||||
throw R|java/lang/Exception.Exception|()
|
||||
}
|
||||
|
||||
local final class LocalClass : R|kotlin/Any| {
|
||||
public constructor(): R|LocalClass| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
init {
|
||||
throw R|java/lang/Exception.Exception|()
|
||||
Int(1)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw R|java/lang/Exception.Exception|()
|
||||
}
|
||||
)"];
|
||||
43 [label="Function call: R|/run|(<L> = run@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> )"];
|
||||
44 [label="Exit property" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
|
||||
@@ -52,16 +52,7 @@ digraph returnValuesFromLambda_kt {
|
||||
21 [label="Exit function anonymousFunction"];
|
||||
}
|
||||
22 [label="Postponed exit from lambda"];
|
||||
23 [label="Function call: R|kotlin/run|<R|A|>(<L> = run@fun <anonymous>(): R|A| <kind=EXACTLY_ONCE> {
|
||||
when () {
|
||||
R|<local>/b| -> {
|
||||
^@run R|/B.B|()
|
||||
}
|
||||
}
|
||||
|
||||
^ R|/C.C|()
|
||||
}
|
||||
)"];
|
||||
23 [label="Function call: R|kotlin/run|<R|A|>(<L> = run@fun <anonymous>(): R|A| <kind=EXACTLY_ONCE> )"];
|
||||
24 [label="Variable declaration: lval x: R|A|"];
|
||||
25 [label="Exit function test_1" style="filled" fillcolor=red];
|
||||
}
|
||||
@@ -103,10 +94,7 @@ digraph returnValuesFromLambda_kt {
|
||||
32 [label="Exit function anonymousFunction"];
|
||||
}
|
||||
33 [label="Postponed exit from lambda"];
|
||||
34 [label="Function call: R|kotlin/run|<R|C|>(<L> = run@fun <anonymous>(): R|C| <kind=EXACTLY_ONCE> {
|
||||
^@run R|/C.C|()
|
||||
}
|
||||
)"];
|
||||
34 [label="Function call: R|kotlin/run|<R|C|>(<L> = run@fun <anonymous>(): R|C| <kind=EXACTLY_ONCE> )"];
|
||||
35 [label="Variable declaration: lval x: R|C|"];
|
||||
36 [label="Exit function test_2" style="filled" fillcolor=red];
|
||||
}
|
||||
@@ -136,10 +124,7 @@ digraph returnValuesFromLambda_kt {
|
||||
42 [label="Exit function anonymousFunction" style="filled" fillcolor=gray];
|
||||
}
|
||||
43 [label="Postponed exit from lambda"];
|
||||
44 [label="Function call: R|kotlin/run|<R|kotlin/Nothing|>(<L> = run@fun <anonymous>(): R|kotlin/Nothing| <kind=EXACTLY_ONCE> {
|
||||
^test_3 Unit
|
||||
}
|
||||
)"];
|
||||
44 [label="Function call: R|kotlin/run|<R|kotlin/Nothing|>(<L> = run@fun <anonymous>(): R|kotlin/Nothing| <kind=EXACTLY_ONCE> )"];
|
||||
45 [label="Stub" style="filled" fillcolor=gray];
|
||||
46 [label="Variable declaration: lval x: R|kotlin/Nothing|" style="filled" fillcolor=gray];
|
||||
47 [label="Exit function test_3" style="filled" fillcolor=red];
|
||||
|
||||
+1
-4
@@ -427,10 +427,7 @@ digraph returns_kt {
|
||||
161 [label="Variable declaration: lval length: R|kotlin/Int|"];
|
||||
162 [label="Postponed enter to lambda"];
|
||||
163 [label="Postponed exit from lambda"];
|
||||
164 [label="Function call: R|/runHigherOrder|<R|kotlin/Int|>(<L> = runHigherOrder@fun <anonymous>(): R|kotlin/Int| {
|
||||
^ R|<local>/s|.R|kotlin/String.length|
|
||||
}
|
||||
)"];
|
||||
164 [label="Function call: R|/runHigherOrder|<R|kotlin/Int|>(<L> = runHigherOrder@fun <anonymous>(): R|kotlin/Int|)"];
|
||||
165 [label="Exit function test_4" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
|
||||
+3
-13
@@ -56,10 +56,7 @@ digraph inPlaceLambdas_kt {
|
||||
20 [label="Exit function anonymousFunction"];
|
||||
}
|
||||
21 [label="Postponed exit from lambda"];
|
||||
22 [label="Function call: R|/run|(<L> = run@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> {
|
||||
R|<local>/x|.R|/A.foo|()
|
||||
}
|
||||
)"];
|
||||
22 [label="Function call: R|/run|(<L> = run@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> )"];
|
||||
23 [label="Exit block"];
|
||||
}
|
||||
24 [label="Exit when branch result"];
|
||||
@@ -102,10 +99,7 @@ digraph inPlaceLambdas_kt {
|
||||
32 [label="Exit function anonymousFunction"];
|
||||
}
|
||||
33 [label="Postponed exit from lambda"];
|
||||
34 [label="Function call: R|/run|(<L> = run@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> {
|
||||
^ (R|<local>/x| as R|B|)
|
||||
}
|
||||
)"];
|
||||
34 [label="Function call: R|/run|(<L> = run@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> )"];
|
||||
35 [label="Access variable R|<local>/x|"];
|
||||
36 [label="Function call: R|<local>/x|.R|/B.bar|()"];
|
||||
37 [label="Exit function test_2" style="filled" fillcolor=red];
|
||||
@@ -153,11 +147,7 @@ digraph inPlaceLambdas_kt {
|
||||
53 [label="Exit function anonymousFunction"];
|
||||
}
|
||||
54 [label="Postponed exit from lambda"];
|
||||
55 [label="Function call: R|/run|(<L> = run@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> {
|
||||
R|<local>/x|.R|/A.foo|()
|
||||
^ (R|<local>/x| as R|B|)
|
||||
}
|
||||
)"];
|
||||
55 [label="Function call: R|/run|(<L> = run@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> )"];
|
||||
56 [label="Access variable R|<local>/x|"];
|
||||
57 [label="Function call: R|<local>/x|.R|/B.bar|()"];
|
||||
58 [label="Exit block"];
|
||||
|
||||
+3
-31
@@ -215,46 +215,18 @@ digraph implicitReceivers_kt {
|
||||
79 [label="Exit function anonymousFunction"];
|
||||
}
|
||||
80 [label="Postponed exit from lambda"];
|
||||
81 [label="Function call: R|kotlin/with|<R|kotlin/Any|, R|kotlin/Unit|>(R|<local>/c|, <L> = wc@fun R|kotlin/Any|.<anonymous>(): R|kotlin/Unit| <kind=EXACTLY_ONCE> {
|
||||
(this@R|special/anonymous| as R|A|)
|
||||
this@R|special/anonymous|.R|/A.foo|()
|
||||
this@R|special/anonymous|.R|/A.foo|()
|
||||
}
|
||||
)"];
|
||||
81 [label="Function call: R|kotlin/with|<R|kotlin/Any|, R|kotlin/Unit|>(R|<local>/c|, <L> = wc@fun R|kotlin/Any|.<anonymous>(): R|kotlin/Unit| <kind=EXACTLY_ONCE> )"];
|
||||
82 [label="Access variable this@R|special/anonymous|"];
|
||||
83 [label="Function call: this@R|special/anonymous|.R|/A.foo|()"];
|
||||
84 [label="Function call: this@R|special/anonymous|.R|/A.foo|()"];
|
||||
85 [label="Exit function anonymousFunction"];
|
||||
}
|
||||
86 [label="Postponed exit from lambda"];
|
||||
87 [label="Function call: R|kotlin/with|<R|kotlin/Any|, R|kotlin/Unit|>(R|<local>/b|, <L> = wb@fun R|kotlin/Any|.<anonymous>(): R|kotlin/Unit| <kind=EXACTLY_ONCE> {
|
||||
R|kotlin/with|<R|kotlin/Any|, R|kotlin/Unit|>(R|<local>/c|, <L> = wc@fun R|kotlin/Any|.<anonymous>(): R|kotlin/Unit| <kind=EXACTLY_ONCE> {
|
||||
(this@R|special/anonymous| as R|A|)
|
||||
this@R|special/anonymous|.R|/A.foo|()
|
||||
this@R|special/anonymous|.R|/A.foo|()
|
||||
}
|
||||
)
|
||||
this@R|special/anonymous|.R|/A.foo|()
|
||||
this@R|special/anonymous|.R|/A.foo|()
|
||||
}
|
||||
)"];
|
||||
87 [label="Function call: R|kotlin/with|<R|kotlin/Any|, R|kotlin/Unit|>(R|<local>/b|, <L> = wb@fun R|kotlin/Any|.<anonymous>(): R|kotlin/Unit| <kind=EXACTLY_ONCE> )"];
|
||||
88 [label="Exit function anonymousFunction"];
|
||||
}
|
||||
89 [label="Postponed exit from lambda"];
|
||||
90 [label="Function call: R|kotlin/with|<R|kotlin/Any|, R|kotlin/Unit|>(R|<local>/a|, <L> = wa@fun R|kotlin/Any|.<anonymous>(): R|kotlin/Unit| <kind=EXACTLY_ONCE> {
|
||||
R|kotlin/with|<R|kotlin/Any|, R|kotlin/Unit|>(R|<local>/b|, <L> = wb@fun R|kotlin/Any|.<anonymous>(): R|kotlin/Unit| <kind=EXACTLY_ONCE> {
|
||||
R|kotlin/with|<R|kotlin/Any|, R|kotlin/Unit|>(R|<local>/c|, <L> = wc@fun R|kotlin/Any|.<anonymous>(): R|kotlin/Unit| <kind=EXACTLY_ONCE> {
|
||||
(this@R|special/anonymous| as R|A|)
|
||||
this@R|special/anonymous|.R|/A.foo|()
|
||||
this@R|special/anonymous|.R|/A.foo|()
|
||||
}
|
||||
)
|
||||
this@R|special/anonymous|.R|/A.foo|()
|
||||
this@R|special/anonymous|.R|/A.foo|()
|
||||
}
|
||||
)
|
||||
}
|
||||
)"];
|
||||
90 [label="Function call: R|kotlin/with|<R|kotlin/Any|, R|kotlin/Unit|>(R|<local>/a|, <L> = wa@fun R|kotlin/Any|.<anonymous>(): R|kotlin/Unit| <kind=EXACTLY_ONCE> )"];
|
||||
91 [label="Exit function test_3" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
|
||||
@@ -115,10 +115,7 @@ digraph safeCalls_kt {
|
||||
45 [label="Enter safe call"];
|
||||
46 [label="Postponed enter to lambda"];
|
||||
47 [label="Postponed exit from lambda"];
|
||||
48 [label="Function call: (R|<local>/x| as? R|A|)?.R|/A.bar|(R|<local>/x|)?.R|/foo|(R|<local>/x|.R|/A.bool|())?.R|/let|(<L> = let@fun <anonymous>(): R|kotlin/Unit| {
|
||||
^ R|<local>/x|.R|/A.bool|()
|
||||
}
|
||||
)"];
|
||||
48 [label="Function call: (R|<local>/x| as? R|A|)?.R|/A.bar|(R|<local>/x|)?.R|/foo|(R|<local>/x|.R|/A.bool|())?.R|/let|(<L> = let@fun <anonymous>(): R|kotlin/Unit|)"];
|
||||
49 [label="Exit safe call"];
|
||||
50 [label="Access variable R|<local>/x|"];
|
||||
51 [label="Function call: R|<local>/x|.<Unresolved name: bool>#()"];
|
||||
@@ -205,18 +202,12 @@ digraph safeCalls_kt {
|
||||
77 [label="Exit function anonymousFunction" style="filled" fillcolor=gray];
|
||||
}
|
||||
78 [label="Postponed exit from lambda"];
|
||||
79 [label="Function call: R|<local>/x|?.R|kotlin/let|<R|A|, R|kotlin/Nothing|>(<L> = let@fun <anonymous>(it: R|A|): R|kotlin/Nothing| <kind=EXACTLY_ONCE> {
|
||||
^test_5 Unit
|
||||
}
|
||||
)"];
|
||||
79 [label="Function call: R|<local>/x|?.R|kotlin/let|<R|A|, R|kotlin/Nothing|>(<L> = let@fun <anonymous>(it: R|A|): R|kotlin/Nothing| <kind=EXACTLY_ONCE> )"];
|
||||
80 [label="Exit safe call"];
|
||||
81 [label="Enter safe call"];
|
||||
82 [label="Access variable R|<local>/x|"];
|
||||
83 [label="Function call: R|<local>/x|.R|/A.bool|()"];
|
||||
84 [label="Function call: R|<local>/x|?.R|kotlin/let|<R|A|, R|kotlin/Nothing|>(<L> = let@fun <anonymous>(it: R|A|): R|kotlin/Nothing| <kind=EXACTLY_ONCE> {
|
||||
^test_5 Unit
|
||||
}
|
||||
)?.R|/boo|(R|<local>/x|.R|/A.bool|())"];
|
||||
84 [label="Function call: R|<local>/x|?.R|kotlin/let|<R|A|, R|kotlin/Nothing|>(<L> = let@fun <anonymous>(it: R|A|): R|kotlin/Nothing| <kind=EXACTLY_ONCE> )?.R|/boo|(R|<local>/x|.R|/A.bool|())"];
|
||||
85 [label="Exit safe call"];
|
||||
86 [label="Access variable R|<local>/x|"];
|
||||
87 [label="Function call: R|<local>/x|.<Inapplicable(WRONG_RECEIVER): [/A.id]>#()"];
|
||||
|
||||
@@ -217,10 +217,7 @@ digraph smartcastToNothing_kt {
|
||||
89 [label="Exit function anonymousFunction"];
|
||||
}
|
||||
90 [label="Postponed exit from lambda"];
|
||||
91 [label="Function call: R|<local>/s|?.R|kotlin/let|<R|A|, R|kotlin/Int|>(<L> = let@fun <anonymous>(it: R|A|): R|kotlin/Int| <kind=EXACTLY_ONCE> {
|
||||
^ R|<local>/it|.R|/A.a|
|
||||
}
|
||||
)"];
|
||||
91 [label="Function call: R|<local>/s|?.R|kotlin/let|<R|A|, R|kotlin/Int|>(<L> = let@fun <anonymous>(it: R|A|): R|kotlin/Int| <kind=EXACTLY_ONCE> )"];
|
||||
92 [label="Exit safe call"];
|
||||
93 [label="Exit function test_0" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
+8
-40
@@ -16,10 +16,7 @@ digraph callsInPlace_kt {
|
||||
6 [label="Exit function anonymousFunction"];
|
||||
}
|
||||
7 [label="Postponed exit from lambda"];
|
||||
8 [label="Function call: R|kotlin/run|<R|kotlin/Unit|>(<L> = run@fun <anonymous>(): R|kotlin/Unit| <kind=EXACTLY_ONCE> {
|
||||
R|<local>/x| = Int(1)
|
||||
}
|
||||
)"];
|
||||
8 [label="Function call: R|kotlin/run|<R|kotlin/Unit|>(<L> = run@fun <anonymous>(): R|kotlin/Unit| <kind=EXACTLY_ONCE> )"];
|
||||
9 [label="Access variable R|<local>/x|"];
|
||||
10 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()"];
|
||||
11 [label="Exit function test" style="filled" fillcolor=red];
|
||||
@@ -50,10 +47,7 @@ digraph callsInPlace_kt {
|
||||
17 [label="Exit function anonymousFunction"];
|
||||
}
|
||||
18 [label="Postponed exit from lambda"];
|
||||
19 [label="Function call: R|kotlin/repeat|(Int(10), <L> = repeat@fun <anonymous>(it: R|kotlin/Int|): R|kotlin/Unit| <kind=UNKNOWN> {
|
||||
^ String(test_2)
|
||||
}
|
||||
)"];
|
||||
19 [label="Function call: R|kotlin/repeat|(Int(10), <L> = repeat@fun <anonymous>(it: R|kotlin/Int|): R|kotlin/Unit| <kind=UNKNOWN> )"];
|
||||
20 [label="Exit function test_2" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
@@ -80,10 +74,7 @@ digraph callsInPlace_kt {
|
||||
}
|
||||
26 [label="Postponed exit from lambda"];
|
||||
27 [label="Const: Int(10)"];
|
||||
28 [label="Function call: R|kotlin/repeat|(action = repeat@fun <anonymous>(it: R|kotlin/Int|): R|kotlin/Unit| <kind=UNKNOWN> {
|
||||
^ String(test_3)
|
||||
}
|
||||
, times = Int(10))"];
|
||||
28 [label="Function call: R|kotlin/repeat|(action = repeat@fun <anonymous>(it: R|kotlin/Int|): R|kotlin/Unit| <kind=UNKNOWN> , times = Int(10))"];
|
||||
29 [label="Exit function test_3" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
@@ -113,11 +104,7 @@ digraph callsInPlace_kt {
|
||||
38 [label="Exit function anonymousFunction"];
|
||||
}
|
||||
39 [label="Postponed exit from lambda"];
|
||||
40 [label="Function call: Int(1).R|kotlin/takeUnless|<R|kotlin/Int|>(<L> = takeUnless@fun <anonymous>(it: R|kotlin/Int|): R|kotlin/Boolean| <kind=EXACTLY_ONCE> {
|
||||
String(test_4)
|
||||
^ >(R|<local>/it|, Int(0))
|
||||
}
|
||||
)"];
|
||||
40 [label="Function call: Int(1).R|kotlin/takeUnless|<R|kotlin/Int|>(<L> = takeUnless@fun <anonymous>(it: R|kotlin/Int|): R|kotlin/Boolean| <kind=EXACTLY_ONCE> )"];
|
||||
41 [label="Exit function test_4" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
@@ -149,11 +136,7 @@ digraph callsInPlace_kt {
|
||||
50 [label="Exit function anonymousFunction"];
|
||||
}
|
||||
51 [label="Postponed exit from lambda"];
|
||||
52 [label="Function call: Int(1).R|kotlin/takeUnless|<R|kotlin/Int|>(predicate = takeUnless@fun <anonymous>(it: R|kotlin/Int|): R|kotlin/Boolean| <kind=EXACTLY_ONCE> {
|
||||
String(test_5)
|
||||
^ >(R|<local>/it|, Int(0))
|
||||
}
|
||||
)"];
|
||||
52 [label="Function call: Int(1).R|kotlin/takeUnless|<R|kotlin/Int|>(predicate = takeUnless@fun <anonymous>(it: R|kotlin/Int|): R|kotlin/Boolean| <kind=EXACTLY_ONCE> )"];
|
||||
53 [label="Exit function test_5" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
@@ -201,13 +184,7 @@ digraph callsInPlace_kt {
|
||||
67 [label="Exit function anonymousFunction"];
|
||||
}
|
||||
68 [label="Postponed exit from lambda"];
|
||||
69 [label="Function call: R|/myRun|(myRun@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> {
|
||||
^ String(test_6_1)
|
||||
}
|
||||
, <L> = myRun@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> {
|
||||
^ String(test_6_2)
|
||||
}
|
||||
)"];
|
||||
69 [label="Function call: R|/myRun|(myRun@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> , <L> = myRun@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> )"];
|
||||
70 [label="Exit function test_6" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
@@ -247,13 +224,7 @@ digraph callsInPlace_kt {
|
||||
80 [label="Exit function anonymousFunction"];
|
||||
}
|
||||
81 [label="Postponed exit from lambda"];
|
||||
82 [label="Function call: R|/myRun|(block2 = myRun@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> {
|
||||
^ String(test_7_2)
|
||||
}
|
||||
, block1 = myRun@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> {
|
||||
^ String(test_7_1)
|
||||
}
|
||||
)"];
|
||||
82 [label="Function call: R|/myRun|(block2 = myRun@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> , block1 = myRun@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> )"];
|
||||
83 [label="Exit function test_7" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
@@ -289,10 +260,7 @@ digraph callsInPlace_kt {
|
||||
87 [label="Enter function test_8" style="filled" fillcolor=red];
|
||||
88 [label="Postponed enter to lambda"];
|
||||
89 [label="Postponed exit from lambda"];
|
||||
90 [label="Function call: R|/myDummyRun|(<L> = myDummyRun@fun <anonymous>(): R|kotlin/Unit| {
|
||||
^ String(test_8)
|
||||
}
|
||||
)"];
|
||||
90 [label="Function call: R|/myDummyRun|(<L> = myDummyRun@fun <anonymous>(): R|kotlin/Unit|)"];
|
||||
91 [label="Exit function test_8" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
|
||||
+2
-8
@@ -47,10 +47,7 @@ digraph tryWithLambdaInside_kt {
|
||||
15 [label="Exit function anonymousFunction"];
|
||||
}
|
||||
16 [label="Postponed exit from lambda"];
|
||||
17 [label="Function call: R|<local>/list|.R|kotlin/collections/filter|(<L> = filter@fun <anonymous>(it: R|kotlin/Boolean|): R|kotlin/Boolean| <kind=UNKNOWN> {
|
||||
^ R|<local>/it|
|
||||
}
|
||||
)"];
|
||||
17 [label="Function call: R|<local>/list|.R|kotlin/collections/filter|(<L> = filter@fun <anonymous>(it: R|kotlin/Boolean|): R|kotlin/Boolean| <kind=UNKNOWN> )"];
|
||||
18 [label="Exit block"];
|
||||
}
|
||||
19 [label="Try main block exit"];
|
||||
@@ -119,10 +116,7 @@ finally {
|
||||
32 [label="Access variable R|<local>/list|"];
|
||||
33 [label="Postponed enter to lambda"];
|
||||
34 [label="Postponed exit from lambda"];
|
||||
35 [label="Function call: R|<local>/list|.R|/notInPlaceFilter|(<L> = notInPlaceFilter@fun <anonymous>(it: R|kotlin/Boolean|): R|kotlin/Boolean| {
|
||||
^ R|<local>/it|
|
||||
}
|
||||
)"];
|
||||
35 [label="Function call: R|<local>/list|.R|/notInPlaceFilter|(<L> = notInPlaceFilter@fun <anonymous>(it: R|kotlin/Boolean|): R|kotlin/Boolean|)"];
|
||||
36 [label="Exit block"];
|
||||
}
|
||||
37 [label="Try main block exit"];
|
||||
|
||||
@@ -25,21 +25,27 @@ import org.jetbrains.kotlin.fir.symbols.impl.FirClassLikeSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol
|
||||
import org.jetbrains.kotlin.fir.types.*
|
||||
import org.jetbrains.kotlin.fir.visitors.FirVisitor
|
||||
import org.jetbrains.kotlin.fir.visitors.FirVisitorVoid
|
||||
import org.jetbrains.kotlin.name.SpecialNames
|
||||
import org.jetbrains.kotlin.types.Variance
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
|
||||
fun FirElement.renderWithType(): String = buildString {
|
||||
fun FirElement.renderWithType(mode: FirRenderer.RenderMode = FirRenderer.RenderMode.Normal): String = buildString {
|
||||
append(this@renderWithType)
|
||||
append(": ")
|
||||
this@renderWithType.accept(FirRenderer(this))
|
||||
this@renderWithType.accept(FirRenderer(this, mode))
|
||||
}
|
||||
|
||||
fun FirElement.render(): String = buildString { this@render.accept(FirRenderer(this)) }
|
||||
fun FirElement.render(mode: FirRenderer.RenderMode = FirRenderer.RenderMode.Normal): String =
|
||||
buildString { this@render.accept(FirRenderer(this, mode)) }
|
||||
|
||||
class FirRenderer(builder: StringBuilder, private val mode: RenderMode = RenderMode.Normal) : FirVisitorVoid() {
|
||||
enum class RenderMode {
|
||||
Normal, DontRenderLambdaBodies
|
||||
}
|
||||
|
||||
class FirRenderer(builder: StringBuilder) : FirVisitorVoid() {
|
||||
private val printer = Printer(builder)
|
||||
|
||||
private var lineBeginning = true
|
||||
@@ -421,7 +427,9 @@ class FirRenderer(builder: StringBuilder) : FirVisitorVoid() {
|
||||
if (anonymousFunction.invocationKind != null) {
|
||||
print(" <kind=${anonymousFunction.invocationKind}> ")
|
||||
}
|
||||
anonymousFunction.body?.renderBody()
|
||||
if (mode != RenderMode.DontRenderLambdaBodies) {
|
||||
anonymousFunction.body?.renderBody()
|
||||
}
|
||||
}
|
||||
|
||||
override fun <F : FirFunction<F>> visitFunction(function: FirFunction<F>) {
|
||||
|
||||
Reference in New Issue
Block a user