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