FIR LT: simplify defaultValue() search
This commit is contained in:
+6
-7
@@ -345,14 +345,13 @@ private fun FlyweightCapableTreeStructure<LighterASTNode>.defaultValue(node: Lig
|
|||||||
val childrenRef = Ref<Array<LighterASTNode?>>()
|
val childrenRef = Ref<Array<LighterASTNode?>>()
|
||||||
getChildren(node, childrenRef)
|
getChildren(node, childrenRef)
|
||||||
// p : T = v
|
// p : T = v
|
||||||
return childrenRef.get()?.reversed()?.firstOrNull {
|
val children = childrenRef.get()?.reversed() ?: return null
|
||||||
it != null &&
|
for (child in children) {
|
||||||
it.tokenType != KtTokens.WHITE_SPACE &&
|
if (child == null || child.tokenType == KtTokens.WHITE_SPACE) continue
|
||||||
it.tokenType != KtTokens.EQ &&
|
if (child.tokenType == KtNodeTypes.TYPE_REFERENCE || child.tokenType == KtTokens.COLON) return null
|
||||||
it.tokenType != KtNodeTypes.TYPE_REFERENCE &&
|
return child
|
||||||
it.tokenType != KtTokens.COLON &&
|
|
||||||
it.tokenType != KtTokens.IDENTIFIER
|
|
||||||
}
|
}
|
||||||
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
fun FlyweightCapableTreeStructure<LighterASTNode>.findChildByType(node: LighterASTNode, type: IElementType): LighterASTNode? {
|
fun FlyweightCapableTreeStructure<LighterASTNode>.findChildByType(node: LighterASTNode, type: IElementType): LighterASTNode? {
|
||||||
|
|||||||
Reference in New Issue
Block a user