[FIR] Rewind DFA after call arguments for correct receiver smartcasting
^KT-63709 Fixed
This commit is contained in:
@@ -703,6 +703,24 @@ class ResolvedQualifierNode(
|
||||
}
|
||||
}
|
||||
|
||||
class FunctionCallArgumentsEnterNode(owner: ControlFlowGraph, override val fir: FirFunctionCall, level: Int) :
|
||||
CFGNode<FirFunctionCall>(owner, level), EnterNodeMarker {
|
||||
override fun <R, D> accept(visitor: ControlFlowGraphVisitor<R, D>, data: D): R {
|
||||
return visitor.visitFunctionCallArgumentsEnterNode(this, data)
|
||||
}
|
||||
}
|
||||
|
||||
class FunctionCallArgumentsExitNode(
|
||||
owner: ControlFlowGraph,
|
||||
override val fir: FirFunctionCall,
|
||||
val enterNode: FunctionCallArgumentsEnterNode,
|
||||
level: Int,
|
||||
) : CFGNode<FirFunctionCall>(owner, level), ExitNodeMarker {
|
||||
override fun <R, D> accept(visitor: ControlFlowGraphVisitor<R, D>, data: D): R {
|
||||
return visitor.visitFunctionCallArgumentsExitNode(this, data)
|
||||
}
|
||||
}
|
||||
|
||||
class FunctionCallNode(owner: ControlFlowGraph, override val fir: FirFunctionCall, level: Int)
|
||||
: CFGNode<FirFunctionCall>(owner, level) {
|
||||
override val isUnion: Boolean
|
||||
|
||||
@@ -57,6 +57,8 @@ fun CFGNode<*>.render(): String =
|
||||
}"
|
||||
|
||||
is VariableAssignmentNode -> "Assignment: ${fir.calleeReference?.let(CfgRenderer::renderElementAsString)}"
|
||||
is FunctionCallArgumentsEnterNode -> "Function call arguments enter"
|
||||
is FunctionCallArgumentsExitNode -> "Function call arguments exit"
|
||||
is FunctionCallNode -> "Function call: ${CfgRenderer.renderElementAsString(fir)}"
|
||||
is DelegatedConstructorCallNode -> "Delegated constructor call: ${CfgRenderer.renderElementAsString(fir)}"
|
||||
is StringConcatenationCallNode -> "String concatenation call: ${CfgRenderer.renderElementAsString(fir)}"
|
||||
|
||||
+8
@@ -319,6 +319,14 @@ abstract class ControlFlowGraphVisitor<out R, in D> {
|
||||
return visitNode(node, data)
|
||||
}
|
||||
|
||||
open fun visitFunctionCallArgumentsEnterNode(node: FunctionCallArgumentsEnterNode, data: D): R {
|
||||
return visitNode(node, data)
|
||||
}
|
||||
|
||||
open fun visitFunctionCallArgumentsExitNode(node: FunctionCallArgumentsExitNode, data: D): R {
|
||||
return visitNode(node, data)
|
||||
}
|
||||
|
||||
open fun visitFunctionCallNode(node: FunctionCallNode, data: D): R {
|
||||
return visitNode(node, data)
|
||||
}
|
||||
|
||||
+16
@@ -239,6 +239,14 @@ abstract class ControlFlowGraphVisitorVoid : ControlFlowGraphVisitor<Unit, Nothi
|
||||
visitNode(node)
|
||||
}
|
||||
|
||||
open fun visitFunctionCallArgumentsEnterNode(node: FunctionCallArgumentsEnterNode) {
|
||||
visitNode(node)
|
||||
}
|
||||
|
||||
open fun visitFunctionCallArgumentsExitNode(node: FunctionCallArgumentsExitNode) {
|
||||
visitNode(node)
|
||||
}
|
||||
|
||||
open fun visitFunctionCallNode(node: FunctionCallNode) {
|
||||
visitNode(node)
|
||||
}
|
||||
@@ -512,6 +520,14 @@ abstract class ControlFlowGraphVisitorVoid : ControlFlowGraphVisitor<Unit, Nothi
|
||||
visitResolvedQualifierNode(node)
|
||||
}
|
||||
|
||||
final override fun visitFunctionCallArgumentsEnterNode(node: FunctionCallArgumentsEnterNode, data: Nothing?) {
|
||||
visitFunctionCallArgumentsEnterNode(node)
|
||||
}
|
||||
|
||||
final override fun visitFunctionCallArgumentsExitNode(node: FunctionCallArgumentsExitNode, data: Nothing?) {
|
||||
visitFunctionCallArgumentsExitNode(node)
|
||||
}
|
||||
|
||||
final override fun visitFunctionCallNode(node: FunctionCallNode, data: Nothing?) {
|
||||
visitFunctionCallNode(node)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user