From 4e6542a6465d4e8a58e7339a23d98702dcbbaf38 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Tue, 16 Jun 2020 10:59:10 +0300 Subject: [PATCH] [FIR] Add Stub kind for CFG Edges of stub graphs shouldn't be completed --- .../jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraph.kt | 2 ++ .../kotlin/fir/resolve/dfa/cfg/ControlFlowGraphBuilder.kt | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraph.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraph.kt index fc59360bd9d..6b7a7b5ce1b 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraph.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraph.kt @@ -35,6 +35,7 @@ class ControlFlowGraph(val declaration: FirDeclaration?, val name: String, val k internal fun complete() { assertState(State.Building) state = State.Completed + if (kind == Kind.Stub) return val sortedNodes = orderNodes() assert(sortedNodes.size == _nodes.size) for (node in _nodes) { @@ -80,6 +81,7 @@ class ControlFlowGraph(val declaration: FirDeclaration?, val name: String, val k TopLevel(withBody = false), AnnotationCall(withBody = true), DefaultArgument(withBody = false), + Stub(withBody = true) } } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphBuilder.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphBuilder.kt index 1d55cb0c748..ad328773865 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphBuilder.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphBuilder.kt @@ -318,7 +318,7 @@ class ControlFlowGraphBuilder { fun enterClass() { pushGraph( - ControlFlowGraph(null, "STUB_CLASS_GRAPH", ControlFlowGraph.Kind.ClassInitializer), + ControlFlowGraph(null, "STUB_CLASS_GRAPH", ControlFlowGraph.Kind.Stub), mode = Mode.ClassInitializer ) }