[FIR] Make check for dangling modifier lists use stubs
Seventh step for ^KT-52615 Merge-request: KT-MR-8651 Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
This commit is contained in:
@@ -69,5 +69,11 @@ class KtClassBody : KtElementImplStub<KotlinPlaceHolderStub<KtClassBody>>, KtDec
|
||||
* @return annotations that do not belong to any declaration due to incomplete code or syntax errors
|
||||
*/
|
||||
val danglingAnnotations: List<KtAnnotationEntry>
|
||||
get() = getStubOrPsiChildrenAsList(MODIFIER_LIST).flatMap { it.annotationEntries }
|
||||
get() = danglingModifierLists.flatMap { it.annotationEntries }
|
||||
|
||||
/**
|
||||
* @return modifier lists that do not belong to any declaration due to incomplete code or syntax errors
|
||||
*/
|
||||
val danglingModifierLists: List<KtModifierList>
|
||||
get() = getStubOrPsiChildrenAsList(MODIFIER_LIST)
|
||||
}
|
||||
|
||||
@@ -128,18 +128,23 @@ open class KtFile(viewProvider: FileViewProvider, val isCompiled: Boolean) :
|
||||
get() = script != null
|
||||
|
||||
/**
|
||||
* @return annotations that do not belong to any declaration due to incomplete code or syntax errors
|
||||
* @return modifier lists that do not belong to any declaration due to incomplete code or syntax errors
|
||||
*/
|
||||
val danglingAnnotations: List<KtAnnotationEntry>
|
||||
val danglingModifierLists: Array<out KtModifierList>
|
||||
get() {
|
||||
val stub = stub
|
||||
val danglingModifierLists = stub?.getChildrenByType(
|
||||
return stub?.getChildrenByType(
|
||||
KtStubElementTypes.MODIFIER_LIST,
|
||||
KtStubElementTypes.MODIFIER_LIST.arrayFactory
|
||||
) ?: findChildrenByClass(KtModifierList::class.java)
|
||||
return danglingModifierLists.flatMap { obj: KtModifierList -> obj.annotationEntries }
|
||||
}
|
||||
|
||||
/**
|
||||
* @return annotations that do not belong to any declaration due to incomplete code or syntax errors
|
||||
*/
|
||||
val danglingAnnotations: List<KtAnnotationEntry>
|
||||
get() = danglingModifierLists.flatMap { obj: KtModifierList -> obj.annotationEntries }
|
||||
|
||||
override fun getFileType(): FileType = KotlinFileType.INSTANCE
|
||||
|
||||
override fun toString(): String = "KtFile: $name"
|
||||
|
||||
Reference in New Issue
Block a user