in core/src/main/java/com/facebook/ktfmt/format/KotlinInputAstVisitor.kt [198:216]
override fun visitTypeReference(typeReference: KtTypeReference) {
builder.sync(typeReference)
// Normally we'd visit the children nodes through accessors on 'typeReference', and we wouldn't
// loop over children.
// But, in this case the modifier list can either be inside the parenthesis:
// ... (@Composable (x) -> Unit)
// or outside of them:
// ... @Composable ((x) -> Unit)
val modifierList = typeReference.modifierList
val typeElement = typeReference.typeElement
for (child in typeReference.node.children()) {
when {
child.psi == modifierList -> visit(modifierList)
child.psi == typeElement -> visit(typeElement)
child.elementType == KtTokens.LPAR -> builder.token("(")
child.elementType == KtTokens.RPAR -> builder.token(")")
}
}
}