[KLIB tool] Dump metadata for all non-private declarations
This is done to make the output of "dump-metadata" command consistent with the output of "dump-metadata-signatures" and "dump-ir-signatures", which dump signatures for all non-private declarations. ^KT-62340
This commit is contained in:
committed by
Space Team
parent
1f3da86021
commit
ab09a3d0fe
+7
-4
@@ -2,6 +2,9 @@ package org.jetbrains.kotlin.cli.klib
|
||||
|
||||
import org.jetbrains.kotlin.backend.konan.descriptors.getPackageFragments
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities.PUBLIC
|
||||
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities.PROTECTED
|
||||
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities.INTERNAL
|
||||
import org.jetbrains.kotlin.descriptors.impl.DeclarationDescriptorVisitorEmptyBodies
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
|
||||
@@ -12,15 +15,15 @@ internal class DeclarationPrinter(
|
||||
) {
|
||||
private val printer = Printer(out, 1, " ")
|
||||
|
||||
private val DeclarationDescriptorWithVisibility.isPublicOrProtected: Boolean
|
||||
get() = visibility == DescriptorVisibilities.PUBLIC || visibility == DescriptorVisibilities.PROTECTED
|
||||
private val DeclarationDescriptorWithVisibility.isNonPrivate: Boolean
|
||||
get() = visibility == PUBLIC || visibility == PROTECTED || visibility == INTERNAL
|
||||
|
||||
private val CallableMemberDescriptor.isFakeOverride: Boolean
|
||||
get() = kind == CallableMemberDescriptor.Kind.FAKE_OVERRIDE
|
||||
|
||||
private val DeclarationDescriptor.shouldBePrinted: Boolean
|
||||
get() = this is ClassifierDescriptorWithTypeParameters && isPublicOrProtected
|
||||
|| this is CallableMemberDescriptor && isPublicOrProtected && !isFakeOverride
|
||||
get() = this is ClassifierDescriptorWithTypeParameters && isNonPrivate
|
||||
|| this is CallableMemberDescriptor && isNonPrivate && !isFakeOverride
|
||||
|
||||
fun print(module: ModuleDescriptor) {
|
||||
module.accept(PrinterVisitor(), Unit)
|
||||
|
||||
@@ -74,7 +74,7 @@ fun printUsage() {
|
||||
(such as Compose) were used during compilation of the library, there would be different
|
||||
signatures for patched declarations.
|
||||
signatures [DEPRECATED] Renamed to "dump-metadata-signatures". Please, use new command name.
|
||||
dump-metadata Dump the metadata of all public declarations in the library in the form of Kotlin-alike code.
|
||||
dump-metadata Dump the metadata of all non-private declarations in the library in the form of Kotlin-alike code.
|
||||
The output of this command is intended to be used for debugging purposes only.
|
||||
contents [DEPRECATED] Renamed to "dump-metadata". Please, use new command name.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user