[FE] Support analyzable files throughout all 'KtPsiFactory' API
Before, the only way of getting analyzable elements was to create an analyzable file by using 'createAnalyzableFile()'. So made all utilities available in 'KtPsiFactory' useless as they delegate to 'createFile()' that always set the 'doNotAnalyze' flag. The new behavior is to pass the 'analysisContext' instead if it is passed to the 'KtPsiFactory' constructor. The newly appeared API is going to be used in the Kotlin's UAST implementation.
This commit is contained in:
+1
-1
@@ -146,7 +146,7 @@ abstract class KtLightClassForFacadeBase constructor(
|
||||
continue
|
||||
}
|
||||
|
||||
val psiFactory = KtPsiFactory(this)
|
||||
val psiFactory = KtPsiFactory(project)
|
||||
val annotationText = "${JVM_NAME_SHORT}(\"$name\")"
|
||||
val newFileAnnotationList = psiFactory.createFileAnnotationListWithAnnotation(annotationText)
|
||||
val annotationList = file.fileAnnotationList
|
||||
|
||||
@@ -48,7 +48,7 @@ fun PsiReferenceList.addSuperTypeEntry(
|
||||
// Only classes may be mentioned in 'extends' list, thus create super call instead simple type reference
|
||||
val entryToAdd =
|
||||
if ((reference.parent as? PsiReferenceList)?.role == PsiReferenceList.Role.IMPLEMENTS_LIST && role == PsiReferenceList.Role.EXTENDS_LIST) {
|
||||
KtPsiFactory(this).createSuperTypeCallEntry("${entry.text}()")
|
||||
KtPsiFactory(project).createSuperTypeCallEntry("${entry.text}()")
|
||||
} else entry
|
||||
// TODO: implement KtSuperListEntry qualification/shortening when inserting reference from another context
|
||||
if (entry.parent != superTypeList) {
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ abstract class KtLightMethodImpl protected constructor(
|
||||
|
||||
val nameExpression = jvmNameAnnotation?.let { JvmFileClassUtil.getLiteralStringEntryFromAnnotation(it) }
|
||||
if (nameExpression != null) {
|
||||
nameExpression.replace(KtPsiFactory(this).createLiteralStringTemplateEntry(name))
|
||||
nameExpression.replace(KtPsiFactory(project).createLiteralStringTemplateEntry(name))
|
||||
} else {
|
||||
val toRename = kotlinOrigin as? PsiNamedElement ?: cannotModify()
|
||||
toRename.setName(newNameForOrigin)
|
||||
|
||||
Reference in New Issue
Block a user