[Commonizer] Update stats collector to report lifted up declarations
This commit is contained in:
+9
-4
@@ -9,6 +9,7 @@ import org.jetbrains.kotlin.descriptors.*
|
|||||||
import org.jetbrains.kotlin.descriptors.commonizer.StatsCollector
|
import org.jetbrains.kotlin.descriptors.commonizer.StatsCollector
|
||||||
import org.jetbrains.kotlin.descriptors.commonizer.utils.firstNonNull
|
import org.jetbrains.kotlin.descriptors.commonizer.utils.firstNonNull
|
||||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||||
|
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
|
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
@@ -33,13 +34,14 @@ import java.io.File
|
|||||||
* - VAL
|
* - VAL
|
||||||
*
|
*
|
||||||
* Possible values for "common" column:
|
* Possible values for "common" column:
|
||||||
|
* - L = declaration lifted up to common fragment
|
||||||
* - E = successfully commonized, expect declaration generated
|
* - E = successfully commonized, expect declaration generated
|
||||||
* - "-" = no common declaration
|
* - "-" = no common declaration
|
||||||
*
|
*
|
||||||
* Possible values for each target platform column:
|
* Possible values for each target platform column:
|
||||||
* - A = successfully commonized, actual declaration generated
|
* - A = successfully commonized, actual declaration generated
|
||||||
* - O = not commonized, the declaration is as in the original library
|
* - O = not commonized, the declaration is as in the original library
|
||||||
* - "-" = no such declaration in the original library
|
* - "-" = no such declaration in the original library (or declaration has been lifted up)
|
||||||
*
|
*
|
||||||
* Example of output:
|
* Example of output:
|
||||||
|
|
||||||
@@ -133,13 +135,16 @@ class NativeStatsCollector(
|
|||||||
companion object {
|
companion object {
|
||||||
private const val SEPARATOR = '|'
|
private const val SEPARATOR = '|'
|
||||||
|
|
||||||
|
private inline val DeclarationDescriptor.topLevelnessPrefix: String
|
||||||
|
get() = if (DescriptorUtils.isTopLevelDeclaration(this)) "TOP-LEVEL " else "NESTED "
|
||||||
|
|
||||||
private inline val DeclarationDescriptor.declarationType: String
|
private inline val DeclarationDescriptor.declarationType: String
|
||||||
get() = when (this) {
|
get() = when (this) {
|
||||||
is ClassDescriptor -> if (isCompanionObject) "COMPANION_OBJECT" else kind.toString()
|
is ClassDescriptor -> if (isCompanionObject) "COMPANION_OBJECT" else topLevelnessPrefix + kind.toString()
|
||||||
is TypeAliasDescriptor -> "TYPE_ALIAS"
|
is TypeAliasDescriptor -> "TYPE_ALIAS"
|
||||||
is ClassConstructorDescriptor -> "CLASS_CONSTRUCTOR"
|
is ClassConstructorDescriptor -> "CLASS_CONSTRUCTOR"
|
||||||
is FunctionDescriptor -> "FUN"
|
is FunctionDescriptor -> topLevelnessPrefix + "FUN"
|
||||||
is PropertyDescriptor -> "VAL"
|
is PropertyDescriptor -> topLevelnessPrefix + if (isConst) "CONST-VAL" else "VAL"
|
||||||
is ModuleDescriptor -> "MODULE"
|
is ModuleDescriptor -> "MODULE"
|
||||||
else -> "UNKNOWN: ${this::class.java}"
|
else -> "UNKNOWN: ${this::class.java}"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user