From 942fe110209919bfafb9cca81f5ed91d07318762 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Fri, 15 Sep 2017 17:10:02 +0200 Subject: [PATCH] Correctly convert KtParameter to UAST --- .../org/jetbrains/uast/kotlin/KotlinUastLanguagePlugin.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/KotlinUastLanguagePlugin.kt b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/KotlinUastLanguagePlugin.kt index 883b45c8d2b..8cdf9a0e66f 100644 --- a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/KotlinUastLanguagePlugin.kt +++ b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/KotlinUastLanguagePlugin.kt @@ -174,6 +174,12 @@ class KotlinUastLanguagePlugin : UastLanguagePlugin { } } } + is KtParameter -> el { + val ownerFunction = original.ownerFunction as? KtFunction ?: return null + val lightMethod = LightClassUtil.getLightClassMethod(ownerFunction) ?: return null + val lightParameter = lightMethod.parameterList.parameters.find { it.name == original.name } ?: return null + KotlinUParameter(lightParameter, givenParent) + } is KtFile -> el { KotlinUFile(original, this@KotlinUastLanguagePlugin) } is FakeFileForLightClass -> el { KotlinUFile(original.navigationElement, this@KotlinUastLanguagePlugin) } @@ -221,6 +227,7 @@ internal object KotlinConverter { is KtDeclarationModifierList -> unwrapElements(element.parent) is KtContainerNode -> unwrapElements(element.parent) is KtSimpleNameStringTemplateEntry -> unwrapElements(element.parent) + is KtLightParameterList -> unwrapElements(element.parent) else -> element }