From aa4a5b75c7e23be09052bd8672c9dc80f7a57370 Mon Sep 17 00:00:00 2001 From: Alexey Sedunov Date: Mon, 19 Feb 2018 15:55:48 +0300 Subject: [PATCH] UAST: Fall back to JVM platform if element doesn't have a module --- .../org/jetbrains/uast/kotlin/KotlinUastLanguagePlugin.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 8a32a96da26..ec5e74eb4f3 100644 --- a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/KotlinUastLanguagePlugin.kt +++ b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/KotlinUastLanguagePlugin.kt @@ -66,8 +66,9 @@ class KotlinUastLanguagePlugin : UastLanguagePlugin { private val PsiElement.isJvmElement get() = try { // Workaround for UAST used without full-fledged IDEA when ProjectFileIndex is not available - // If we can't get the module, act as if the current platform is JVM - module?.let { TargetPlatformDetector.getPlatform(it) } is JvmPlatform + // If we can't get the module (or don't have one), act as if the current platform is JVM + val module = module + module == null || TargetPlatformDetector.getPlatform(module) is JvmPlatform } catch (e: Exception) { true }