K2. Minor. Rename CFG ConstExpressionNode to LiteralExpressionNode
^KT-64314
This commit is contained in:
committed by
Space Team
parent
53e89a9722
commit
3f4d2e93c6
+3
-3
@@ -1020,9 +1020,9 @@ abstract class FirDataFlowAnalyzer(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun exitConstExpression(constExpression: FirLiteralExpression<*>) {
|
fun exitLiteralExpression(literalExpression: FirLiteralExpression<*>) {
|
||||||
if (constExpression.isResolved) return
|
if (literalExpression.isResolved) return
|
||||||
graphBuilder.exitConstExpression(constExpression).mergeIncomingFlow()
|
graphBuilder.exitLiteralExpression(literalExpression).mergeIncomingFlow()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun exitLocalVariableDeclaration(variable: FirProperty, hadExplicitType: Boolean) {
|
fun exitLocalVariableDeclaration(variable: FirProperty, hadExplicitType: Boolean) {
|
||||||
|
|||||||
+2
-2
@@ -1330,8 +1330,8 @@ class ControlFlowGraphBuilder {
|
|||||||
return node
|
return node
|
||||||
}
|
}
|
||||||
|
|
||||||
fun exitLiteralExpression(constExpression: FirLiteralExpression<*>): ConstExpressionNode {
|
fun exitLiteralExpression(literalExpression: FirLiteralExpression<*>): LiteralExpressionNode {
|
||||||
return createConstExpressionNode(constExpression).also { addNewSimpleNode(it) }
|
return createLiteralExpressionNode(literalExpression).also { addNewSimpleNode(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun exitVariableDeclaration(variable: FirProperty): VariableDeclarationNode {
|
fun exitVariableDeclaration(variable: FirProperty): VariableDeclarationNode {
|
||||||
|
|||||||
+2
-2
@@ -163,8 +163,8 @@ fun ControlFlowGraphBuilder.createElvisExitNode(fir: FirElvisExpression): ElvisE
|
|||||||
fun ControlFlowGraphBuilder.createVariableDeclarationNode(fir: FirProperty): VariableDeclarationNode =
|
fun ControlFlowGraphBuilder.createVariableDeclarationNode(fir: FirProperty): VariableDeclarationNode =
|
||||||
VariableDeclarationNode(currentGraph, fir, levelCounter)
|
VariableDeclarationNode(currentGraph, fir, levelCounter)
|
||||||
|
|
||||||
fun ControlFlowGraphBuilder.createConstExpressionNode(fir: FirLiteralExpression<*>): ConstExpressionNode =
|
fun ControlFlowGraphBuilder.createLiteralExpressionNode(fir: FirLiteralExpression<*>): LiteralExpressionNode =
|
||||||
ConstExpressionNode(currentGraph, fir, levelCounter)
|
LiteralExpressionNode(currentGraph, fir, levelCounter)
|
||||||
|
|
||||||
fun ControlFlowGraphBuilder.createThrowExceptionNode(fir: FirThrowExpression): ThrowExceptionNode =
|
fun ControlFlowGraphBuilder.createThrowExceptionNode(fir: FirThrowExpression): ThrowExceptionNode =
|
||||||
ThrowExceptionNode(currentGraph, fir, levelCounter)
|
ThrowExceptionNode(currentGraph, fir, levelCounter)
|
||||||
|
|||||||
+1
-1
@@ -1205,7 +1205,7 @@ open class FirExpressionsResolveTransformer(transformer: FirAbstractBodyResolveT
|
|||||||
else -> kind.expectedConeType(session)
|
else -> kind.expectedConeType(session)
|
||||||
}
|
}
|
||||||
|
|
||||||
dataFlowAnalyzer.exitConstExpression(literalExpression as FirLiteralExpression<*>)
|
dataFlowAnalyzer.exitLiteralExpression(literalExpression as FirLiteralExpression<*>)
|
||||||
literalExpression.resultType = type
|
literalExpression.resultType = type
|
||||||
|
|
||||||
return when (val resolvedType = literalExpression.resolvedType) {
|
return when (val resolvedType = literalExpression.resolvedType) {
|
||||||
|
|||||||
@@ -668,9 +668,9 @@ class JumpNode(owner: ControlFlowGraph, override val fir: FirJump<*>, level: Int
|
|||||||
return visitor.visitJumpNode(this, data)
|
return visitor.visitJumpNode(this, data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
class ConstExpressionNode(owner: ControlFlowGraph, override val fir: FirLiteralExpression<*>, level: Int) : CFGNode<FirLiteralExpression<*>>(owner, level) {
|
class LiteralExpressionNode(owner: ControlFlowGraph, override val fir: FirLiteralExpression<*>, level: Int) : CFGNode<FirLiteralExpression<*>>(owner, level) {
|
||||||
override fun <R, D> accept(visitor: ControlFlowGraphVisitor<R, D>, data: D): R {
|
override fun <R, D> accept(visitor: ControlFlowGraphVisitor<R, D>, data: D): R {
|
||||||
return visitor.visitConstExpressionNode(this, data)
|
return visitor.visitLiteralExpressionNode(this, data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -50,7 +50,7 @@ fun CFGNode<*>.render(): String =
|
|||||||
is StubNode -> "Stub"
|
is StubNode -> "Stub"
|
||||||
is CheckNotNullCallNode -> "Check not null: ${CfgRenderer.renderElementAsString(fir)}"
|
is CheckNotNullCallNode -> "Check not null: ${CfgRenderer.renderElementAsString(fir)}"
|
||||||
|
|
||||||
is ConstExpressionNode -> "Const: ${fir.render()}"
|
is LiteralExpressionNode -> "Const: ${fir.render()}"
|
||||||
is VariableDeclarationNode ->
|
is VariableDeclarationNode ->
|
||||||
"Variable declaration: ${
|
"Variable declaration: ${
|
||||||
CfgRenderer.renderAsCallableDeclarationString(fir)
|
CfgRenderer.renderAsCallableDeclarationString(fir)
|
||||||
|
|||||||
+1
-1
@@ -299,7 +299,7 @@ abstract class ControlFlowGraphVisitor<out R, in D> {
|
|||||||
return visitNode(node, data)
|
return visitNode(node, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun visitConstExpressionNode(node: ConstExpressionNode, data: D): R {
|
open fun visitLiteralExpressionNode(node: LiteralExpressionNode, data: D): R {
|
||||||
return visitNode(node, data)
|
return visitNode(node, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -219,7 +219,7 @@ abstract class ControlFlowGraphVisitorVoid : ControlFlowGraphVisitor<Unit, Nothi
|
|||||||
visitNode(node)
|
visitNode(node)
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun visitConstExpressionNode(node: ConstExpressionNode) {
|
open fun visitLiteralExpressionNode(node: LiteralExpressionNode) {
|
||||||
visitNode(node)
|
visitNode(node)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -500,8 +500,8 @@ abstract class ControlFlowGraphVisitorVoid : ControlFlowGraphVisitor<Unit, Nothi
|
|||||||
visitJumpNode(node)
|
visitJumpNode(node)
|
||||||
}
|
}
|
||||||
|
|
||||||
final override fun visitConstExpressionNode(node: ConstExpressionNode, data: Nothing?) {
|
final override fun visitLiteralExpressionNode(node: LiteralExpressionNode, data: Nothing?) {
|
||||||
visitConstExpressionNode(node)
|
visitLiteralExpressionNode(node)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------- Check not null call -----------------------------------
|
// ----------------------------------- Check not null call -----------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user