Code cleanup: several inspections applied
This commit is contained in:
committed by
Mikhail Glukhikh
parent
fdca96634e
commit
840847e47c
@@ -475,7 +475,7 @@ class KotlinIndicesHelper(
|
||||
private fun KtNamedDeclaration.resolveToDescriptorsWithHack(
|
||||
psiFilter: (KtDeclaration) -> Boolean): Collection<DeclarationDescriptor> {
|
||||
if (containingKtFile.isCompiled) { //TODO: it's temporary while resolveToDescriptor does not work for compiled declarations
|
||||
return resolutionFacade.resolveImportReference(moduleDescriptor, fqName!!).filterIsInstance<DeclarationDescriptor>()
|
||||
return resolutionFacade.resolveImportReference(moduleDescriptor, fqName!!)
|
||||
}
|
||||
else {
|
||||
val translatedDeclaration = declarationTranslator(this) ?: return emptyList()
|
||||
|
||||
@@ -168,7 +168,7 @@ fun String.quoteIfNeeded(): String = if (KotlinNameSuggester.isIdentifier(this))
|
||||
fun String.unquote(): String = KtPsiUtil.unquoteIdentifier(this)
|
||||
|
||||
fun FqName.quoteSegmentsIfNeeded(): String {
|
||||
return pathSegments().map { it.asString().quoteIfNeeded() }.joinToString(".")
|
||||
return pathSegments().joinToString(".") { it.asString().quoteIfNeeded() }
|
||||
}
|
||||
|
||||
fun FqName.quoteIfNeeded() = FqName(quoteSegmentsIfNeeded())
|
||||
|
||||
@@ -176,7 +176,7 @@ fun <T : KtDeclaration> insertMembersAfter(
|
||||
val body = classOrObject.getOrCreateBody()
|
||||
|
||||
var afterAnchor = anchor ?: findInsertAfterAnchor(editor, body) ?: return@runWriteAction emptyList<T>()
|
||||
otherMembers.mapNotNullTo(insertedMembers) {
|
||||
otherMembers.mapTo(insertedMembers) {
|
||||
if (classOrObject is KtClass && classOrObject.isEnum()) {
|
||||
val enumEntries = classOrObject.declarations.filterIsInstance<KtEnumEntry>()
|
||||
val bound = (enumEntries.lastOrNull() ?: classOrObject.allChildren.firstOrNull { it.node.elementType == KtTokens.SEMICOLON })
|
||||
|
||||
Reference in New Issue
Block a user