[FIR] Fix detecting selector for safe calls in light tree

This commit is contained in:
Dmitriy Novozhilov
2021-06-24 12:50:02 +03:00
committed by teamcityserver
parent 4f8c854ead
commit 9116c341ba
@@ -947,11 +947,12 @@ fun FlyweightCapableTreeStructure<LighterASTNode>.selector(node: LighterASTNode)
var dotOrDoubleColonFound = false
for (child in children) {
if (child == null) continue
if (child.tokenType == KtTokens.DOT || child.tokenType == KtTokens.COLONCOLON) {
val tokenType = child.tokenType
if (tokenType == KtTokens.DOT || tokenType == KtTokens.COLONCOLON || tokenType == KtTokens.SAFE_ACCESS) {
dotOrDoubleColonFound = true
continue
}
if (dotOrDoubleColonFound && (child.tokenType == KtNodeTypes.CALL_EXPRESSION || child.tokenType == KtNodeTypes.REFERENCE_EXPRESSION)) {
if (dotOrDoubleColonFound && (tokenType == KtNodeTypes.CALL_EXPRESSION || tokenType == KtNodeTypes.REFERENCE_EXPRESSION)) {
return child
}
}