[FIR LT] Optimize LighterASTNode.getChildNodeByType

Instead of creating a list first, return the first matching element of
the array.
This commit is contained in:
Kirill Rakhman
2023-06-22 11:10:20 +02:00
committed by Space Team
parent 8519053527
commit dcb200d6d3
@@ -99,7 +99,7 @@ abstract class AbstractLightTreeRawFirBuilder(
}
override fun LighterASTNode.getChildNodeByType(type: IElementType): LighterASTNode? {
return this.getChildNodesByType(type).firstOrNull()
return getChildrenAsArray().firstOrNull { it?.tokenType == type }
}
override val LighterASTNode?.receiverExpression: LighterASTNode?