UAST: Fall back to JVM platform if element doesn't have a module

This commit is contained in:
Alexey Sedunov
2018-02-19 15:55:48 +03:00
parent 5edfc0f5cd
commit aa4a5b75c7
@@ -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
}