Wrap KtClassOrObject.isLocal, KtFile.isScript with runReadAction in LightClasses

#EA-211576 Fixed

(cherry picked from commit 75a59d4bced714af51abd7e354bc873313b28051)
This commit is contained in:
Vladimir Dolzhenko
2019-10-26 09:42:49 +02:00
parent 96768cbf2d
commit 00055fc20a
5 changed files with 25 additions and 14 deletions
@@ -129,7 +129,7 @@ class IDELightClassGenerationSupport(private val project: Project) : LightClassG
override fun createUltraLightClass(element: KtClassOrObject): KtUltraLightClass? {
if (element.shouldNotBeVisibleAsLightClass() ||
element is KtEnumEntry ||
element.containingKtFile.isScript()
element.containingKtFile.safeIsScript()
) {
return null
}
@@ -139,7 +139,7 @@ class IDELightClassGenerationSupport(private val project: Project) : LightClassG
element is KtObjectDeclaration && element.isObjectLiteral() ->
KtUltraLightClassForAnonymousDeclaration(element, support)
element.isLocal ->
element.safeIsLocal() ->
KtUltraLightClassForLocalDeclaration(element, support)
(element.hasModifier(KtTokens.INLINE_KEYWORD)) ->
@@ -219,5 +219,4 @@ class IDELightClassGenerationSupport(private val project: Project) : LightClassG
override fun analyze(element: KtElement) = element.analyze(BodyResolveMode.PARTIAL)
override fun analyzeWithContent(element: KtClassOrObject) = element.analyzeWithContent()
}
}