[KLIB] Implement new linker based on IdSignature

- Remove klib dependency on metadata and uniqID
 - Refactored proto format to make it more effective and compact
  -- Use special encoding for some types of data (coordinates, flags, types)
  -- Remove symbols table
  -- Use packed proto list if it is possible
 - Remove extension from metadata
 - Remove special ids for function interfaces
 - Fix klib IO
 - Fix incremental cache
 - General code clean up
This commit is contained in:
Roman Artemev
2020-01-27 15:58:52 +03:00
committed by romanart
parent 31d73c5d79
commit 6a37955a36
211 changed files with 6616 additions and 78716 deletions
@@ -128,8 +128,8 @@ open class IncrementalJsCache(
}
for ((srcFile, irData) in incrementalResults.irFileData) {
val (fileData, symbols, types, strings, declarations, bodies, fqn) = irData
irTranslationResults.put(srcFile, fileData, symbols, types, strings, declarations, bodies, fqn)
val (fileData, types, signatures, strings, declarations, bodies, fqn) = irData
irTranslationResults.put(srcFile, fileData, types, signatures, strings, declarations, bodies, fqn)
}
}
@@ -240,8 +240,8 @@ private class TranslationResultMap(
private object IrTranslationResultValueExternalizer : DataExternalizer<IrTranslationResultValue> {
override fun save(output: DataOutput, value: IrTranslationResultValue) {
output.writeArray(value.fileData)
output.writeArray(value.symbols)
output.writeArray(value.types)
output.writeArray(value.signatures)
output.writeArray(value.strings)
output.writeArray(value.declarations)
output.writeArray(value.bodies)
@@ -262,14 +262,14 @@ private object IrTranslationResultValueExternalizer : DataExternalizer<IrTransla
override fun read(input: DataInput): IrTranslationResultValue {
val fileData = input.readArray()
val symbols = input.readArray()
val types = input.readArray()
val signatures = input.readArray()
val strings = input.readArray()
val declarations = input.readArray()
val bodies = input.readArray()
val fqn = input.readArray()
return IrTranslationResultValue(fileData, symbols, types, strings, declarations, bodies, fqn)
return IrTranslationResultValue(fileData, types, signatures, strings, declarations, bodies, fqn)
}
}
@@ -280,8 +280,8 @@ private class IrTranslationResultMap(
BasicStringMap<IrTranslationResultValue>(storageFile, IrTranslationResultValueExternalizer) {
override fun dumpValue(value: IrTranslationResultValue): String =
"Filedata: ${value.fileData.md5()}, " +
"Symbols: ${value.symbols.md5()}, " +
"Types: ${value.types.md5()}, " +
"Signatures: ${value.signatures.md5()}, " +
"Strings: ${value.strings.md5()}, " +
"Declarations: ${value.declarations.md5()}, " +
"Bodies: ${value.bodies.md5()}"
@@ -289,15 +289,15 @@ private class IrTranslationResultMap(
fun put(
sourceFile: File,
newFiledata: ByteArray,
newSymbols: ByteArray,
newTypes: ByteArray,
newSignatures: ByteArray,
newStrings: ByteArray,
newDeclarations: ByteArray,
newBodies: ByteArray,
fqn: ByteArray
) {
storage[pathConverter.toPath(sourceFile)] =
IrTranslationResultValue(newFiledata, newSymbols, newTypes, newStrings, newDeclarations, newBodies, fqn)
IrTranslationResultValue(newFiledata, newTypes, newSignatures, newStrings, newDeclarations, newBodies, fqn)
}
operator fun get(sourceFile: File): IrTranslationResultValue? =
@@ -34,7 +34,6 @@ import org.jetbrains.kotlin.backend.common.phaser.PhaseConfig
import org.jetbrains.kotlin.backend.common.serialization.signature.IdSignatureDescriptor
import org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory
import org.jetbrains.kotlin.backend.jvm.jvmPhases
import org.jetbrains.kotlin.backend.jvm.serialization.JvmManglerDesc
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
import org.jetbrains.kotlin.cli.common.ExitCode
import org.jetbrains.kotlin.cli.common.checkKotlinPackageUsage
@@ -61,6 +60,7 @@ import org.jetbrains.kotlin.fir.resolve.firProvider
import org.jetbrains.kotlin.fir.resolve.impl.FirProviderImpl
import org.jetbrains.kotlin.fir.resolve.transformers.FirTotalResolveTransformer
import org.jetbrains.kotlin.idea.MainFunctionDetector
import org.jetbrains.kotlin.ir.backend.jvm.serialization.JvmManglerDesc
import org.jetbrains.kotlin.javac.JavacWrapper
import org.jetbrains.kotlin.load.kotlin.ModuleVisibilityManager
import org.jetbrains.kotlin.modules.Module
@@ -8,7 +8,6 @@ package org.jetbrains.kotlin.cli.metadata
import org.jetbrains.kotlin.analyzer.ModuleInfo
import org.jetbrains.kotlin.analyzer.common.CommonDependenciesContainer
import org.jetbrains.kotlin.analyzer.common.CommonPlatformAnalyzerServices
import org.jetbrains.kotlin.backend.common.serialization.DescriptorTable
import org.jetbrains.kotlin.backend.common.serialization.metadata.KlibMetadataMonolithicSerializer
import org.jetbrains.kotlin.backend.common.serialization.metadata.KlibMetadataVersion
import org.jetbrains.kotlin.builtins.DefaultBuiltIns
@@ -68,7 +67,6 @@ internal class K2MetadataKlibSerializer(private val metadataVersion: BuiltInsBin
val serializedMetadata: SerializedMetadata = KlibMetadataMonolithicSerializer(
configuration.languageVersionSettings,
metadataVersion,
DescriptorTable.createDefault(),
skipExpects = false,
includeOnlyModuleContent = true
).serializeModule(module)
@@ -18,8 +18,8 @@ class RemoteIncrementalResultsConsumer(val facade: CompilerCallbackServicesFacad
override fun processIrFile(
sourceFile: File,
fileData: ByteArray,
symbols: ByteArray,
types: ByteArray,
signatures: ByteArray,
strings: ByteArray,
declarations: ByteArray,
bodies: ByteArray,
@@ -29,8 +29,7 @@ class RemoteIncrementalResultsConsumer(val facade: CompilerCallbackServicesFacad
}
init {
eventManager.
onCompilationFinished(this::flush)
eventManager.onCompilationFinished(this::flush)
}
override fun processHeader(headerMetadata: ByteArray) {
@@ -166,8 +166,9 @@ class Fir2IrDeclarationStorage(
val descriptor = WrappedClassDescriptor()
val origin = IrDeclarationOrigin.DEFINED
val modality = regularClass?.modality ?: Modality.FINAL
val visibility = regularClass?.visibility ?: Visibilities.PUBLIC
return klass.convertWithOffsets { startOffset, endOffset ->
irSymbolTable.declareClass(startOffset, endOffset, origin, descriptor, modality) { symbol ->
irSymbolTable.declareClass(startOffset, endOffset, origin, descriptor, modality, visibility) { symbol ->
IrClassImpl(
startOffset,
endOffset,
@@ -30,7 +30,7 @@ class FirPackageFragmentDescriptor(override val fqName: FqName, val moduleDescri
}
override fun <R : Any?, D : Any?> accept(visitor: DeclarationDescriptorVisitor<R, D>?, data: D): R {
TODO("not implemented")
return visitor?.visitPackageFragmentDescriptor(this, data) as R
}
override fun getSource(): SourceElement {
@@ -38,7 +38,7 @@ class FirPackageFragmentDescriptor(override val fqName: FqName, val moduleDescri
}
override fun acceptVoid(visitor: DeclarationDescriptorVisitor<Void, Void>?) {
TODO("not implemented")
visitor?.visitPackageFragmentDescriptor(this, null)
}
override val annotations: Annotations
@@ -12,7 +12,6 @@ import com.intellij.psi.search.GlobalSearchScope
import junit.framework.TestCase
import org.jetbrains.kotlin.asJava.finder.JavaElementFinder
import org.jetbrains.kotlin.backend.common.serialization.signature.IdSignatureDescriptor
import org.jetbrains.kotlin.backend.jvm.serialization.JvmManglerDesc
import org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM
import org.jetbrains.kotlin.config.languageVersionSettings
import org.jetbrains.kotlin.fir.backend.Fir2IrConverter
@@ -21,6 +20,7 @@ import org.jetbrains.kotlin.fir.resolve.firProvider
import org.jetbrains.kotlin.fir.resolve.impl.FirProviderImpl
import org.jetbrains.kotlin.fir.resolve.transformers.FirTotalResolveTransformer
import org.jetbrains.kotlin.ir.AbstractIrTextTestCase
import org.jetbrains.kotlin.ir.backend.jvm.serialization.JvmManglerDesc
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
import java.io.File
@@ -69,9 +69,11 @@ class JsIrBackendContext(
private var _owner: IrExternalPackageFragment? = null
override val owner get() = _owner!!
override var uniqId: UniqId
get() = error("Operation is unsupported")
set(value) { error("Operation is unsupported") }
override val isPublicApi: Boolean
get() = TODO("Not yet implemented")
override val signature: IdSignature
get() = TODO("Not yet implemented")
override val isBound get() = _owner != null
@@ -8,25 +8,28 @@ package org.jetbrains.kotlin.ir.backend.js
import com.intellij.openapi.project.Project
import org.jetbrains.kotlin.analyzer.AbstractAnalyzerWithCompilerReport
import org.jetbrains.kotlin.backend.common.phaser.PhaseConfig
import org.jetbrains.kotlin.backend.common.phaser.PhaserState
import org.jetbrains.kotlin.backend.common.phaser.invokeToplevel
import org.jetbrains.kotlin.backend.common.serialization.knownBuiltins
import org.jetbrains.kotlin.backend.common.serialization.mangle.ManglerChecker
import org.jetbrains.kotlin.backend.common.serialization.mangle.descriptor.Ir2DescriptorManglerAdapter
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.ir.backend.js.lower.generateTests
import org.jetbrains.kotlin.ir.backend.js.lower.moveBodilessDeclarationsToSeparatePlace
import org.jetbrains.kotlin.ir.backend.js.lower.serialization.ir.JsManglerDesc
import org.jetbrains.kotlin.ir.backend.js.lower.serialization.ir.JsManglerIr
import org.jetbrains.kotlin.ir.backend.js.transformers.irToJs.IrModuleToJsTransformer
import org.jetbrains.kotlin.ir.backend.js.utils.JsMainFunctionDetector
import org.jetbrains.kotlin.ir.backend.js.utils.NameTables
import org.jetbrains.kotlin.ir.backend.js.utils.isJsExport
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
import org.jetbrains.kotlin.ir.declarations.StageController
import org.jetbrains.kotlin.ir.declarations.stageController
import org.jetbrains.kotlin.ir.util.ExternalDependenciesGenerator
import org.jetbrains.kotlin.ir.util.fqNameWhenAvailable
import org.jetbrains.kotlin.ir.util.generateTypicalIrProviderList
import org.jetbrains.kotlin.ir.util.isEffectivelyExternal
import org.jetbrains.kotlin.ir.util.patchDeclarationParents
import org.jetbrains.kotlin.ir.visitors.acceptVoid
import org.jetbrains.kotlin.library.KotlinLibrary
import org.jetbrains.kotlin.library.resolver.KotlinLibraryResolveResult
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.psi.KtFile
class CompilerResult(
val jsCode: String?,
@@ -53,6 +56,11 @@ fun compile(
val (moduleFragment: IrModuleFragment, dependencyModules, irBuiltIns, symbolTable, deserializer) =
loadIr(project, mainModule, analyzer, configuration, allDependencies, friendDependencies)
val mangleChecker = ManglerChecker(JsManglerIr, Ir2DescriptorManglerAdapter(JsManglerDesc))
moduleFragment.acceptVoid(mangleChecker)
irBuiltIns.knownBuiltins.forEach { it.acceptVoid(mangleChecker) }
val moduleDescriptor = moduleFragment.descriptor
val mainFunction = JsMainFunctionDetector.getMainFunctionOrNull(moduleFragment)
@@ -15,7 +15,6 @@ import org.jetbrains.kotlin.ir.backend.js.utils.getJsQualifier
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.declarations.impl.IrFileImpl
import org.jetbrains.kotlin.ir.symbols.IrFileSymbol
import org.jetbrains.kotlin.ir.util.UniqId
import org.jetbrains.kotlin.ir.util.fqNameWhenAvailable
import org.jetbrains.kotlin.ir.util.isEffectivelyExternal
import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid
@@ -12,12 +12,12 @@ import org.jetbrains.kotlin.backend.common.phaser.PhaseConfig
import org.jetbrains.kotlin.backend.jvm.codegen.ClassCodegen
import org.jetbrains.kotlin.backend.jvm.lower.MultifileFacadeFileEntry
import org.jetbrains.kotlin.backend.jvm.serialization.JvmIdSignatureDescriptor
import org.jetbrains.kotlin.backend.jvm.serialization.JvmManglerDesc
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.idea.MainFunctionDetector
import org.jetbrains.kotlin.descriptors.konan.KlibModuleOrigin
import org.jetbrains.kotlin.ir.backend.jvm.serialization.EmptyLoggingContext
import org.jetbrains.kotlin.ir.backend.jvm.serialization.JvmIrLinker
import org.jetbrains.kotlin.ir.backend.jvm.serialization.JvmManglerDesc
import org.jetbrains.kotlin.ir.declarations.IrClass
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
import org.jetbrains.kotlin.ir.types.defaultType
@@ -54,7 +54,7 @@ object JvmBackendFacade {
psi2irContext.moduleDescriptor, psi2irContext.symbolTable, psi2irContext.irBuiltIns.languageVersionSettings, extensions
)
val deserializer = JvmIrLinker(
psi2irContext.moduleDescriptor, EmptyLoggingContext, psi2irContext.irBuiltIns, psi2irContext.symbolTable, stubGenerator
EmptyLoggingContext, psi2irContext.irBuiltIns, psi2irContext.symbolTable
)
psi2irContext.moduleDescriptor.allDependencyModules.filter { it.getCapability(KlibModuleOrigin.CAPABILITY) != null }.forEach {
deserializer.deserializeIrModuleHeader(it)
@@ -13,6 +13,7 @@ import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl
import org.jetbrains.kotlin.descriptors.impl.TypeParameterDescriptorImpl
import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOriginImpl
import org.jetbrains.kotlin.ir.declarations.impl.IrExternalPackageFragmentImpl
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
@@ -42,38 +43,37 @@ class IrBuiltIns(
private val builtInsModule = builtIns.builtInsModule
val irBuiltInsSymbols = mutableListOf<IrBuiltinWithMangle>()
private val symbolTable = outerSymbolTable ?: SymbolTable(signaturer)
private val packageFragmentDescriptor = IrBuiltinsPackageFragmentDescriptorImpl(builtInsModule, KOTLIN_INTERNAL_IR_FQN)
private val packageFragment =
val packageFragment =
IrExternalPackageFragmentImpl(symbolTable.referenceExternalPackageFragment(packageFragmentDescriptor), KOTLIN_INTERNAL_IR_FQN)
private fun ClassDescriptor.toIrSymbol() = symbolTable.referenceClass(this)
private fun KotlinType.toIrType() = typeTranslator.translateType(this)
fun defineOperator(name: String, returnType: IrType, valueParameterTypes: List<IrType>): IrSimpleFunctionSymbol {
val descriptor = WrappedSimpleFunctionDescriptor()
val suffix = valueParameterTypes.joinToString(":", "[", "]") { t -> t.originalKotlinType?.toString() ?: "T" }
val mangle = "operator#$name@$suffix"
val symbol = symbolTable.declareBuiltInOperator(descriptor, mangle) {
val operator = IrBuiltInOperator(it, Name.identifier(name), returnType, suffix)
val operatorDescriptor = IrSimpleBuiltinOperatorDescriptorImpl(packageFragmentDescriptor, Name.identifier(name), returnType.originalKotlinType!!)
for ((i, valueParameterType) in valueParameterTypes.withIndex()) {
val valueParameterDescriptor =
IrBuiltinValueParameterDescriptorImpl(operatorDescriptor, Name.identifier("arg$i"), i, valueParameterType.originalKotlinType!!)
operatorDescriptor.addValueParameter(valueParameterDescriptor)
}
val symbol = symbolTable.declareSimpleFunction(UNDEFINED_OFFSET, UNDEFINED_OFFSET, BUILTIN_OPERATOR, operatorDescriptor) {
val operator = IrBuiltInOperator(it, Name.identifier(name), returnType)
operator.parent = packageFragment
packageFragment.declarations += operator
descriptor.bind(operator)
operator.valueParameters = valueParameterTypes.mapIndexed { i, t ->
val valueParameterDescriptor = WrappedValueParameterDescriptor()
operator.valueParameters = valueParameterTypes.withIndex().map { (i, valueParameterType) ->
val valueParameterDescriptor = operatorDescriptor.valueParameters[i]
val valueParameterSymbol = IrValueParameterSymbolImpl(valueParameterDescriptor)
IrBuiltInOperatorValueParameter(valueParameterSymbol, i, t).apply {
valueParameterDescriptor.bind(this)
IrBuiltInOperatorValueParameter(valueParameterSymbol, i, valueParameterType).apply {
parent = operator
}
}
irBuiltInsSymbols += operator
operator
}
@@ -89,7 +89,7 @@ class IrBuiltIns(
val valueKotlinType: SimpleType
// Note: We still need a complete function descriptor here because `CHECK_NOT_NULL` is being substituted by psi2ir
val descriptor = SimpleFunctionDescriptorImpl.create(
val operatorDescriptor = SimpleFunctionDescriptorImpl.create(
packageFragmentDescriptor,
Annotations.EMPTY,
name,
@@ -135,9 +135,8 @@ class IrBuiltIns(
buildSimpleType()
}
val mangle = "operator#$name@:!!"
return symbolTable.declareBuiltInOperator(descriptor, mangle) {
val operator = IrBuiltInOperator(it, name, returnIrType, ":!!")
return symbolTable.declareSimpleFunction(UNDEFINED_OFFSET, UNDEFINED_OFFSET, BUILTIN_OPERATOR, operatorDescriptor) {
val operator = IrBuiltInOperator(it, name, returnIrType)
operator.parent = packageFragment
packageFragment.declarations += operator
@@ -150,8 +149,6 @@ class IrBuiltIns(
operator.valueParameters += valueParameter
operator.typeParameters += typeParameter
irBuiltInsSymbols += operator
operator
}.symbol
}
@@ -236,6 +233,9 @@ class IrBuiltIns(
private val kMutableProperty1Class = builtIns.kMutableProperty1.toIrSymbol()
private val kMutableProperty2Class = builtIns.kMutableProperty2.toIrSymbol()
val functionClass = builtIns.getBuiltInClassByFqName(FqName("kotlin.Function")).toIrSymbol()
val kFunctionClass = builtIns.getBuiltInClassByFqName(FqName("kotlin.reflect.KFunction")).toIrSymbol()
fun getKPropertyClass(mutable: Boolean, n: Int): IrClassSymbol = when (n) {
0 -> if (mutable) kMutableProperty0Class else kProperty0Class
1 -> if (mutable) kMutableProperty1Class else kProperty1Class
@@ -23,10 +23,6 @@ import org.jetbrains.kotlin.types.Variance
import org.jetbrains.kotlin.utils.SmartList
import kotlin.reflect.KProperty
interface IrBuiltinWithMangle : IrDeclaration, IrSymbolOwner {
val mangle: String
}
abstract class IrBuiltInOperatorBase : IrDeclaration {
override val startOffset: Int get() = UNDEFINED_OFFSET
override val endOffset: Int get() = UNDEFINED_OFFSET
@@ -57,11 +53,9 @@ private class NullValueDelegate<T> {
class IrBuiltInOperator(
override val symbol: IrSimpleFunctionSymbol,
override val name: Name,
override var returnType: IrType,
val suffix: String
override var returnType: IrType
) :
IrSimpleFunction,
IrBuiltinWithMangle,
IrFunction,
IrBuiltInOperatorBase() {
@@ -95,7 +89,6 @@ class IrBuiltInOperator(
override var overriddenSymbols: List<IrSimpleFunctionSymbol> = emptyList()
override var attributeOwnerId: IrAttributeContainer = this
override val mangle: String get() = "operator#$name@$suffix"
init {
symbol.bind(this)
@@ -12,6 +12,16 @@ import org.jetbrains.kotlin.name.FqName
sealed class IdSignature {
enum class Flags(val recursive: Boolean) {
IS_EXPECT(true),
IS_JAVA_FOR_KOTLIN_OVERRIDE_PROPERTY(false),
IS_NATIVE_INTEROP_LIBRARY(true);
fun encode(isSet: Boolean): Long = if (isSet) 1L shl ordinal else 0L
fun decode(flags: Long): Boolean = (flags and (1L shl ordinal) != 0L)
}
abstract val isPublic: Boolean
open fun isPackageSignature() = false
@@ -21,8 +31,14 @@ sealed class IdSignature {
abstract fun packageFqName(): FqName
open fun asPublic(): PublicSignature? = null
abstract fun render(): String
fun Flags.test(): Boolean = decode(flags())
protected open fun flags(): Long = 0
open val hasTopLevel: Boolean get() = !isPackageSignature()
val isLocal: Boolean get() = !isPublic
@@ -37,8 +53,10 @@ sealed class IdSignature {
override fun packageFqName() = packageFqn
private fun adaptMask(old: Long): Long {
// TODO: design the way flags are being mutated up to declaration tree
return old
return old xor Flags.values().fold(0L) { a, f ->
if (!f.recursive) a or (old and (1L shl f.ordinal))
else a
}
}
override fun topLevelSignature(): IdSignature {
@@ -59,9 +77,13 @@ sealed class IdSignature {
override fun nearestPublicSig(): PublicSignature = this
override fun flags(): Long = mask
override fun render(): String = "${packageFqn.asString()}/${classFqn.asString()}|$id[${mask.toString(2)}]"
override fun toString() = super.toString()
override fun asPublic(): PublicSignature? = this
}
class AccessorSignature(val propertySignature: IdSignature, val accessorSignature: PublicSignature) : IdSignature() {
@@ -80,7 +102,11 @@ sealed class IdSignature {
return accessorSignature == other
}
override fun flags(): Long = accessorSignature.mask
override fun hashCode(): Int = accessorSignature.hashCode()
override fun asPublic(): PublicSignature? = accessorSignature
}
data class FileLocalSignature(val container: IdSignature, val id: Long) : IdSignature() {
@@ -106,24 +132,6 @@ sealed class IdSignature {
override fun toString() = super.toString()
}
class BuiltInSignature(val mangle: String, val id: Long) : IdSignature() {
constructor(id: Long) : this("", id)
override fun topLevelSignature(): IdSignature = this // built ins are always top level
override fun nearestPublicSig(): IdSignature = this
override fun packageFqName(): FqName = IrBuiltIns.KOTLIN_INTERNAL_IR_FQN
override val isPublic: Boolean = true
override fun render(): String = "<ß|$mangle>"
override fun equals(other: Any?): Boolean {
return this === other || other is BuiltInSignature && id == other.id
}
override fun hashCode(): Int = id.toInt() xor (id shr 32).toInt()
}
// Used to reference local variable and value parameters in function
class ScopeLocalDeclaration(val id: Int, val description: String = "<no description>") : IdSignature() {
override val isPublic: Boolean = false
@@ -149,6 +157,4 @@ sealed class IdSignature {
interface IdSignatureComposer {
fun composeSignature(descriptor: DeclarationDescriptor): IdSignature?
fun composeEnumEntrySignature(descriptor: ClassDescriptor): IdSignature?
fun string2Hash(s: String): Long
}
@@ -16,8 +16,12 @@ interface KotlinMangler<D : Any> {
fun D.isExported(): Boolean
val D.mangleString: String
val D.signatureString: String
val D.fqnString: String
val D.hashedMangle: Long get() = mangleString.hashMangle
val D.signatureMangle: Long get() = signatureString.hashMangle
val D.fqnMangle: Long get() = fqnString.hashMangle
val manglerName: String
@@ -389,19 +389,6 @@ open class SymbolTable(private val signaturer: IdSignatureComposer) : ReferenceS
override fun referenceClass(descriptor: ClassDescriptor) =
classSymbolTable.referenced(descriptor) { createClassSymbol(descriptor) }
private fun createBuiltInClassSymbol(descriptor: ClassDescriptor, sig: IdSignature): IrClassSymbol {
return IrClassPublicSymbolImpl(descriptor, sig)
}
fun declareBuiltInClass(
descriptor: ClassDescriptor,
mangle: String,
classFactory: (IrClassSymbol) -> IrClass
): IrClass {
val sig = IdSignature.BuiltInSignature(mangle, signaturer.string2Hash(mangle))
return classSymbolTable.declare(sig, descriptor, { createBuiltInClassSymbol(descriptor, sig) }, classFactory)
}
override fun referenceClassFromLinker(descriptor: ClassDescriptor, sig: IdSignature): IrClassSymbol =
classSymbolTable.run {
if (sig.isPublic) referenced(sig) { IrClassPublicSymbolImpl(descriptor, sig) }
@@ -674,29 +661,6 @@ open class SymbolTable(private val signaturer: IdSignatureComposer) : ReferenceS
}
}
private fun createBuiltInOperatorSymbol(descriptor: FunctionDescriptor, sig: IdSignature): IrSimpleFunctionSymbol {
return IrSimpleFunctionPublicSymbolImpl(descriptor, sig)
}
fun declareBuiltInOperator(
descriptor: FunctionDescriptor,
mangle: String,
functionFactory: (IrSimpleFunctionSymbol) -> IrSimpleFunction
): IrSimpleFunction {
val sig = IdSignature.BuiltInSignature(mangle, signaturer.string2Hash(mangle))
return simpleFunctionSymbolTable.declare(
sig,
descriptor,
{ createBuiltInOperatorSymbol(descriptor, sig) },
functionFactory
)
}
fun referenceBuiltInOperator(descriptor: FunctionDescriptor, mangle: String): IrSimpleFunctionSymbol {
val sig = IdSignature.BuiltInSignature(mangle, signaturer.string2Hash(mangle))
return simpleFunctionSymbolTable.referenced(sig) { createBuiltInOperatorSymbol(descriptor, sig) }
}
override fun referenceSimpleFunction(descriptor: FunctionDescriptor) =
simpleFunctionSymbolTable.referenced(descriptor) { createSimpleFunctionSymbol(descriptor) }
@@ -1,15 +0,0 @@
package org.jetbrains.kotlin.ir.util
// This is an abstract uniqIdIndex any serialized IR declarations gets.
// It is either isLocal and then just gets and ordinary number within its module.
// Or is visible across modules and then gets a hash of mangled name as its index.
inline class UniqId(val index: Long) {
val isPublic: Boolean get() = (index and (1L shl 63)) != 0L
val isLocal: Boolean get() = (index and (1L shl 63)) == 0L
companion object {
val NONE = UniqId(0x7fffffffL)
}
}
@@ -5,161 +5,77 @@ option java_multiple_files = true;
option java_outer_classname = "KotlinIr";
option optimize_for = LITE_RUNTIME;
message DescriptorReference {
repeated int32 package_fq_name = 1;
repeated int32 class_fq_name = 2;
required int32 name = 3;
required int32 flags = 4;
optional int64 uniq_id_index = 5;
}
message Coordinates {
required int32 start_offset = 1;
required int32 end_offset = 2;
}
message Visibility {
required int32 name = 1;
}
message IrStatementOrigin {
required int32 name = 1;
}
enum KnownOrigin {
CUSTOM = 1;
DEFINED = 2;
FAKE_OVERRIDE = 3;
FOR_LOOP_ITERATOR = 4;
FOR_LOOP_VARIABLE = 5;
FOR_LOOP_IMPLICIT_VARIABLE = 6;
PROPERTY_BACKING_FIELD = 7;
DEFAULT_PROPERTY_ACCESSOR = 8;
DELEGATE = 9;
DELEGATED_PROPERTY_ACCESSOR = 10;
DELEGATED_MEMBER = 11;
ENUM_CLASS_SPECIAL_MEMBER = 12;
FUNCTION_FOR_DEFAULT_PARAMETER = 13;
FILE_CLASS = 14;
GENERATED_DATA_CLASS_MEMBER = 15;
GENERATED_INLINE_CLASS_MEMBER = 16;
LOCAL_FUNCTION_FOR_LAMBDA = 17;
CATCH_PARAMETER = 19;
INSTANCE_RECEIVER = 20;
PRIMARY_CONSTRUCTOR_PARAMETER = 21;
IR_TEMPORARY_VARIABLE = 22;
IR_EXTERNAL_DECLARATION_STUB = 23;
IR_EXTERNAL_JAVA_DECLARATION_STUB = 24;
IR_BUILTINS_STUB = 25;
BRIDGE = 26;
FIELD_FOR_ENUM_ENTRY = 27;
FIELD_FOR_ENUM_VALUES = 28;
FIELD_FOR_OBJECT_INSTANCE = 29;
}
message IrDeclarationOrigin {
oneof either {
KnownOrigin origin = 1;
int32 custom = 2;
}
}
/* ------ Top Level---------------------------------------------- */
message IrDeclarationContainer {
repeated IrDeclaration declaration = 1;
}
/* ------ Top Level --------------------------------------------- */
message FileEntry {
required string name = 1;
repeated int32 line_start_offsets = 2;
repeated int32 line_start_offsets = 2 [packed=true];
}
message IrFile {
repeated int64 declaration_id = 1;
repeated int32 declaration_id = 1 [packed=true];
required FileEntry file_entry = 2;
repeated int32 fq_name = 3;
repeated int32 fq_name = 3 [packed=true];
repeated IrConstructorCall annotation = 4;
repeated int32 explicitly_exported_to_compiler = 5;
repeated int64 explicitly_exported_to_compiler = 5 [packed=true];
repeated Actual actuals = 6;
}
/* ------ IdSignature -------------------------------------------- */
message PublicIdSignature {
repeated int32 package_fq_name = 1 [packed=true];
repeated int32 class_fq_name = 2 [packed=true];
optional int64 member_uniq_id = 3;
optional int64 flags = 4 [default = 0];
}
message AccessorIdSignature {
required int32 property_signature = 1;
required int32 name = 2;
required int64 accessor_hash_id = 3;
optional int64 flags = 4 [default = 0];
}
message FileLocalIdSignature {
required int32 container = 1;
required int64 local_id = 2;
}
message IdSignature {
oneof idsig {
PublicIdSignature public_sig = 1;
FileLocalIdSignature private_sig = 2;
AccessorIdSignature accessor_sig = 3;
int32 scoped_local_sig = 4;
}
}
/* ------ IrSymbols --------------------------------------------- */
enum IrSymbolKind {
FUNCTION_SYMBOL = 1;
CONSTRUCTOR_SYMBOL = 2;
ENUM_ENTRY_SYMBOL = 3;
FIELD_SYMBOL = 4;
VALUE_PARAMETER_SYMBOL = 5;
RETURNABLE_BLOCK_SYMBOL = 6;
CLASS_SYMBOL = 7;
TYPE_PARAMETER_SYMBOL = 8;
VARIABLE_SYMBOL = 9;
ANONYMOUS_INIT_SYMBOL = 10;
STANDALONE_FIELD_SYMBOL = 11; // For fields without properties. WrappedFieldDescriptor, rather than WrappedPropertyDescriptor.
RECEIVER_PARAMETER_SYMBOL = 12; // ReceiverParameterDescriptor rather than ValueParameterDescriptor.
PROPERTY_SYMBOL = 13;
LOCAL_DELEGATED_PROPERTY_SYMBOL = 14;
TYPEALIAS_SYMBOL = 15;
}
message IrSymbolData {
required IrSymbolKind kind = 1;
required int64 uniq_id_index = 4;
required int64 top_level_uniq_id_index = 5;
repeated int32 fq_name = 6;
optional DescriptorReference descriptor_reference = 7;
}
message Actual {
required int32 actual_symbol = 1;
required int32 expect_symbol = 2;
required int64 actual_symbol = 1;
required int64 expect_symbol = 2;
}
/* ------ IrTypes --------------------------------------------- */
enum IrTypeVariance { // Should we import metadata variance, or better stay separate?
IN = 0;
OUT = 1;
INV = 2;
}
message TypeArguments {
repeated int32 type_argument = 1;
}
message IrStarProjection {
optional bool void = 1;
}
message IrTypeProjection {
required IrTypeVariance variance = 1;
required int32 type = 2;
}
message IrTypeArgument {
oneof kind {
IrStarProjection star = 1;
IrTypeProjection type = 2;
}
}
// Note: IrTypeArgument [63..2 - IrType index | 1..0 - Variance]
// If x...xxx00 -> *
message IrSimpleType {
repeated IrConstructorCall annotation = 1;
required int32 classifier = 2;
required int64 classifier = 2;
required bool has_question_mark = 3;
repeated IrTypeArgument argument = 4;
repeated int64 argument = 4 [packed=true]; // 0 - STAR, otherwise [63..2 - IrType index | 1..0 - Variance]
optional IrTypeAbbreviation abbreviation = 5;
}
message IrTypeAbbreviation {
repeated IrConstructorCall annotation = 1;
required int32 type_alias = 2;
required int64 type_alias = 2;
required bool has_question_mark = 3;
repeated IrTypeArgument argument = 4;
repeated int64 argument = 4 [packed=true]; // 0 - STAR, otherwise [63..2 - IrType index | 1..0 - Variance]
}
message IrDynamicType {
@@ -178,10 +94,6 @@ message IrType {
}
}
message IrTypeTable {
repeated IrType types = 1;
}
/* ------ IrExpressions --------------------------------------------- */
@@ -191,61 +103,61 @@ message IrBreak {
}
message IrBlock {
optional IrStatementOrigin origin = 1;
repeated IrStatement statement = 2;
repeated IrStatement statement = 1;
optional int32 origin_name = 2;
}
message MemberAccessCommon {
optional IrExpression dispatch_receiver = 1;
optional IrExpression extension_receiver = 2;
repeated NullableIrExpression value_argument = 3;
required TypeArguments type_arguments = 4;
repeated int32 type_argument = 4 [packed=true];
}
message IrCall {
required int32 symbol = 1;
required int64 symbol = 1;
required MemberAccessCommon member_access = 2;
optional int32 super = 3;
optional IrStatementOrigin origin = 4;
optional int64 super = 3;
optional int32 origin_name = 4;
}
message IrConstructorCall {
required int32 symbol = 1;
required int64 symbol = 1;
required int32 constructor_type_arguments_count = 2;
required MemberAccessCommon member_access = 3;
}
message IrFunctionReference {
required int32 symbol = 1;
optional IrStatementOrigin origin = 2;
required int64 symbol = 1;
optional int32 origin_name = 2;
required MemberAccessCommon member_access = 3;
optional int32 reflectionTarget = 4;
optional int64 reflectionTargetSymbol = 4;
}
message IrLocalDelegatedPropertyReference {
required int32 delegate = 1;
optional int32 getter = 2;
optional int32 setter = 3;
required int32 symbol = 4;
optional IrStatementOrigin origin = 5;
required int64 delegate = 1;
optional int64 getter = 2;
optional int64 setter = 3;
required int64 symbol = 4;
optional int32 origin_name = 5;
}
message IrPropertyReference {
optional int32 field = 1;
optional int32 getter = 2;
optional int32 setter = 3;
optional IrStatementOrigin origin = 4;
optional int64 field = 1;
optional int64 getter = 2;
optional int64 setter = 3;
optional int32 origin_name = 4;
required MemberAccessCommon member_access = 5;
required int32 symbol = 6;
required int64 symbol = 6;
}
message IrComposite {
repeated IrStatement statement = 1;
optional IrStatementOrigin origin = 2;
optional int32 origin_name = 2;
}
message IrClassReference {
required int32 class_symbol = 1;
required int64 class_symbol = 1;
required int32 class_type = 2;
}
@@ -270,7 +182,7 @@ message IrContinue {
}
message IrDelegatingConstructorCall {
required int32 symbol = 1;
required int64 symbol = 1;
required MemberAccessCommon member_access = 2;
}
@@ -279,7 +191,7 @@ message IrDoWhile {
}
message IrEnumConstructorCall {
required int32 symbol = 1;
required int64 symbol = 1;
required MemberAccessCommon member_access = 2;
}
@@ -288,31 +200,31 @@ message IrGetClass {
}
message IrGetEnumValue {
required int32 symbol = 2;
required int64 symbol = 1;
}
message FieldAccessCommon {
required int32 symbol = 1;
optional int32 super = 2;
required int64 symbol = 1;
optional int64 super = 2;
optional IrExpression receiver = 3;
}
message IrGetField {
required FieldAccessCommon field_access = 1;
optional IrStatementOrigin origin = 2;
optional int32 origin_name = 2;
}
message IrGetValue {
required int32 symbol = 1;
optional IrStatementOrigin origin = 2;
required int64 symbol = 1;
optional int32 origin_name = 2;
}
message IrGetObject {
required int32 symbol = 1;
required int64 symbol = 1;
}
message IrInstanceInitializerCall {
required int32 symbol = 1;
required int64 symbol = 1;
}
message Loop {
@@ -320,29 +232,29 @@ message Loop {
required IrExpression condition = 2;
optional int32 label = 3;
optional IrExpression body = 4;
optional IrStatementOrigin origin = 5;
optional int32 origin_name = 5;
}
message IrReturn {
required int32 return_target = 1;
required int64 return_target = 1;
required IrExpression value = 2;
}
message IrSetField {
required FieldAccessCommon field_access = 1;
required IrExpression value = 2;
optional IrStatementOrigin origin = 3;
optional int32 origin_name = 3;
}
message IrSetVariable {
required int32 symbol = 1;
required int64 symbol = 1;
required IrExpression value = 2;
optional IrStatementOrigin origin = 3;
optional int32 origin_name = 3;
}
message IrSpreadElement {
required IrExpression expression = 1;
required Coordinates coordinates = 2;
required int64 coordinates = 2;
}
message IrStringConcat {
@@ -379,7 +291,7 @@ message IrVarargElement {
message IrWhen {
repeated IrStatement branch = 1;
optional IrStatementOrigin origin = 2;
optional int32 origin_name = 2;
}
message IrWhile {
@@ -388,7 +300,7 @@ message IrWhile {
message IrFunctionExpression {
required IrFunction function = 1;
required IrStatementOrigin origin = 2;
required int32 origin_name = 2;
}
/* ------ Dynamic expression --------------------------------------------- */
@@ -496,7 +408,7 @@ enum IrTypeOperator {
message IrExpression {
required IrOperation operation = 1;
required int32 type = 2;
required Coordinates coordinates = 3;
required int64 coordinates = 3;
}
message NullableIrExpression {
@@ -506,166 +418,94 @@ message NullableIrExpression {
/* ------ Declarations --------------------------------------------- */
message IrDeclarationBase {
required int32 symbol = 1;
required IrDeclarationOrigin origin = 2;
required Coordinates coordinates = 3;
repeated IrConstructorCall annotation = 4;
required int64 symbol = 1;
required int32 origin_name = 2;
required int64 coordinates = 3;
optional int64 flags = 4 [default = 0];
repeated IrConstructorCall annotation = 5;
}
message IrFunctionBase {
required IrDeclarationBase base = 1;
required int32 name = 2;
required Visibility visibility = 3;
required bool is_inline = 4;
required bool is_external = 5;
required IrTypeParameterContainer type_parameters = 6;
optional IrValueParameter dispatch_receiver = 7;
optional IrValueParameter extension_receiver = 8;
repeated IrValueParameter value_parameter = 9;
optional int32 body = 10;
required int32 return_type = 11;
required bool is_expect = 12;
required int64 name_type = 2;
repeated IrTypeParameter type_parameter = 3;
optional IrValueParameter dispatch_receiver = 4;
optional IrValueParameter extension_receiver = 5;
repeated IrValueParameter value_parameter = 6;
optional int32 body = 7;
}
message IrFunction {
required IrFunctionBase base = 1;
required ModalityKind modality = 2;
required bool is_tailrec = 3;
required bool is_suspend = 4;
repeated int32 overridden = 5;
repeated int64 overridden = 2 [packed=true]; // TODO: supposed to be deleted
//optional UniqId corresponding_property = 7;
required bool is_fake_override = 8;
required bool is_operator = 9;
}
message IrConstructor {
required IrFunctionBase base = 1;
required bool is_primary = 2;
}
message IrField {
required IrDeclarationBase base = 1;
optional int32 initializer = 2;
required int32 name = 3;
required Visibility visibility = 4;
required bool is_final = 5;
required bool is_external = 6;
required bool is_static = 7;
required int32 type = 8;
required bool is_fake_override = 9;
required int64 name_type = 2;
optional int32 initializer = 3;
}
message IrLocalDelegatedProperty {
required IrDeclarationBase base = 1;
required int32 name = 2;
required int32 type = 3;
required bool is_var = 4;
required IrVariable delegate = 5;
optional IrFunction getter = 6;
optional IrFunction setter = 7;
required int64 name_type = 2;
required IrVariable delegate = 3;
optional IrFunction getter = 4;
optional IrFunction setter = 5;
}
message IrProperty {
required IrDeclarationBase base = 1;
required int32 name = 2;
required Visibility visibility = 3;
required ModalityKind modality = 4;
required bool is_var = 5;
required bool is_const = 6;
required bool is_lateinit = 7;
required bool is_delegated = 8;
required bool is_external = 9;
optional IrField backing_field = 10;
optional IrFunction getter = 11;
optional IrFunction setter = 12;
required bool is_expect = 13;
required bool is_fake_override = 14;
optional IrField backing_field = 3;
optional IrFunction getter = 4;
optional IrFunction setter = 5;
}
message IrVariable {
required IrDeclarationBase base = 1;
required int32 name = 2;
required int32 type = 3;
required bool is_var = 4;
required bool is_const = 5;
required bool is_lateinit = 6;
optional IrExpression initializer = 7;
}
enum ClassKind {
CLASS = 1;
INTERFACE = 2;
ENUM_CLASS = 3;
ENUM_ENTRY = 4;
ANNOTATION_CLASS = 5;
OBJECT = 6;
}
enum ModalityKind { // It is ModalityKind to not clash with Modality in descriptor metadata.
FINAL_MODALITY = 1;
SEALED_MODALITY = 2;
OPEN_MODALITY = 3;
ABSTRACT_MODALITY = 4;
required int64 name_type =2;
optional IrExpression initializer = 3;
}
message IrValueParameter {
required IrDeclarationBase base = 1;
required int32 name = 2;
required int32 index = 3;
required int32 type = 4;
optional int32 vararg_element_type = 5;
required bool is_crossinline = 6;
required bool is_noinline = 7;
optional int32 default_value = 8;
required int64 name_type = 2;
optional int32 vararg_element_type = 3;
optional int32 default_value = 4;
}
message IrTypeParameter {
required IrDeclarationBase base = 1;
required int32 name = 2;
required int32 index = 3;
required IrTypeVariance variance = 4;
repeated int32 super_type = 5;
required bool is_reified = 6;
}
message IrTypeParameterContainer {
repeated IrTypeParameter type_parameter = 1;
repeated int32 super_type = 3 [packed=true];
}
message IrClass {
required IrDeclarationBase base = 1;
required int32 name = 2;
required ClassKind kind = 3;
required Visibility visibility = 4;
required ModalityKind modality = 5;
// TODO: consider using flags for the booleans.
required bool is_companion = 6;
required bool is_inner = 7;
required bool is_data = 8;
required bool is_external = 9;
required bool is_inline = 10;
optional IrValueParameter this_receiver = 11;
required IrTypeParameterContainer type_parameters = 12;
required IrDeclarationContainer declaration_container = 13;
repeated int32 super_type = 14;
required bool is_expect = 15;
required bool is_fun = 16;
optional IrValueParameter this_receiver = 3;
repeated IrTypeParameter type_parameter = 4;
repeated IrDeclaration declaration = 5;
repeated int32 super_type = 6 [packed=true];
}
message IrTypeAlias {
required IrDeclarationBase base = 1;
required int32 name = 2;
required Visibility visibility = 3;
required IrTypeParameterContainer type_parameters = 4;
required int32 expanded_type = 5;
required bool is_actual = 6;
required int64 name_type = 2;
repeated IrTypeParameter type_parameter = 3;
}
message IrEnumEntry {
required IrDeclarationBase base = 1;
optional int32 initializer = 2;
optional IrClass corresponding_class = 3;
required int32 name = 4;
required int32 name = 2;
optional int32 initializer = 3;
optional IrClass corresponding_class = 4;
}
message IrAnonymousInit {
@@ -720,7 +560,7 @@ message IrSyntheticBody {
// Let's try to map IrElement as well as IrStatement to IrStatement.
message IrStatement {
required Coordinates coordinates = 1;
required int64 coordinates = 1;
oneof statement {
IrDeclaration declaration = 2;
IrExpression expression = 3;
@@ -1,132 +1,86 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.backend.common.serialization
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.Visibilities
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.declarations.lazy.IrLazyDeclarationBase
import org.jetbrains.kotlin.backend.common.serialization.signature.IdSignatureSerializer
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
import org.jetbrains.kotlin.ir.declarations.IrSymbolOwner
import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns
import org.jetbrains.kotlin.ir.util.IdSignature
import org.jetbrains.kotlin.ir.util.KotlinMangler
import org.jetbrains.kotlin.ir.util.UniqId
interface DescriptorTable {
fun put(descriptor: DeclarationDescriptor, uniqId: UniqId)
fun get(descriptor: DeclarationDescriptor): Long?
interface IdSignatureClashTracker {
fun commit(declaration: IrDeclaration, signature: IdSignature)
companion object {
fun createDefault() = object : DescriptorTable {
private val descriptors = mutableMapOf<DeclarationDescriptor, Long>()
override fun put(descriptor: DeclarationDescriptor, uniqId: UniqId) {
descriptors.getOrPut(descriptor) { uniqId.index }
}
override fun get(descriptor: DeclarationDescriptor) = descriptors[descriptor]
val DEFAULT_TRACKER = object : IdSignatureClashTracker {
override fun commit(declaration: IrDeclaration, signature: IdSignature) {}
}
}
}
interface UniqIdClashTracker {
fun commit(declaration: IrDeclaration, uniqId: UniqId)
abstract class GlobalDeclarationTable(
val signaturer: IdSignatureSerializer,
private val mangler: KotlinMangler.IrMangler,
private val clashTracker: IdSignatureClashTracker
) {
private val table = mutableMapOf<IrDeclaration, IdSignature>()
companion object {
val DEFAULT_TRACKER = object : UniqIdClashTracker {
override fun commit(declaration: IrDeclaration, uniqId: UniqId) {}
}
}
}
abstract class GlobalDeclarationTable(private val mangler: KotlinMangler, private val clashTracker: UniqIdClashTracker) {
private val table = mutableMapOf<IrDeclaration, UniqId>()
constructor(mangler: KotlinMangler) : this(mangler, UniqIdClashTracker.DEFAULT_TRACKER)
constructor(signaturer: IdSignatureSerializer, mangler: KotlinMangler.IrMangler) :
this(signaturer, mangler, IdSignatureClashTracker.DEFAULT_TRACKER)
protected fun loadKnownBuiltins(builtIns: IrBuiltIns) {
val mask = 1L shl 63
builtIns.knownBuiltins.forEach {
val index = with(mangler) { it.mangle.hashMangle }
table[it] = UniqId(index or mask).also { id -> clashTracker.commit(it, id) }
val symbol = (it as IrSymbolOwner).symbol
table[it] = symbol.signature.also { id -> clashTracker.commit(it, id) }
}
}
open fun computeUniqIdByDeclaration(declaration: IrDeclaration): UniqId {
open fun computeSignatureByDeclaration(declaration: IrDeclaration): IdSignature {
return table.getOrPut(declaration) {
with(mangler) {
UniqId(declaration.hashedMangle).also { clashTracker.commit(declaration, it) }
}
signaturer.composePublicIdSignature(declaration).also { clashTracker.commit(declaration, it) }
}
}
fun isExportedDeclaration(declaration: IrDeclaration): Boolean = with(mangler) { declaration.isExported() }
}
open class DeclarationTable(
private val descriptorTable: DescriptorTable,
private val globalDeclarationTable: GlobalDeclarationTable,
startIndex: Long
) {
private val table = mutableMapOf<IrDeclaration, UniqId>()
private fun IrDeclaration.isLocalDeclaration(): Boolean {
return origin == IrDeclarationOrigin.FAKE_OVERRIDE || !isExportedDeclaration(this) || this is IrValueDeclaration || this is IrAnonymousInitializer || this is IrLocalDelegatedProperty
open class DeclarationTable(private val globalDeclarationTable: GlobalDeclarationTable) {
private val table = mutableMapOf<IrDeclaration, IdSignature>()
private val signaturer = globalDeclarationTable.signaturer.also {
it.reset()
it.table = this
}
private var localIndex = startIndex
private fun IrDeclaration.isLocalDeclaration(): Boolean {
return !isExportedDeclaration(this)
}
fun isExportedDeclaration(declaration: IrDeclaration) = globalDeclarationTable.isExportedDeclaration(declaration)
protected open fun tryComputeBackendSpecificUniqId(declaration: IrDeclaration): UniqId? =
null
protected open fun tryComputeBackendSpecificSignature(declaration: IrDeclaration): IdSignature? = null
private fun computeUniqIdByDeclaration(declaration: IrDeclaration): UniqId {
tryComputeBackendSpecificUniqId(declaration)?.let { return it }
private fun computeSignatureByDeclaration(declaration: IrDeclaration): IdSignature {
tryComputeBackendSpecificSignature(declaration)?.let { return it }
return if (declaration.isLocalDeclaration()) {
table.getOrPut(declaration) { UniqId(localIndex++) }
} else globalDeclarationTable.computeUniqIdByDeclaration(declaration)
table.getOrPut(declaration) { signaturer.composeFileLocalIdSignature(declaration) }
} else globalDeclarationTable.computeSignatureByDeclaration(declaration)
}
fun uniqIdByDeclaration(declaration: IrDeclaration): UniqId {
val uniqId = computeUniqIdByDeclaration(declaration)
if (declaration.isMetadataDeclaration(false)) {
descriptorTable.put(declaration.descriptor, uniqId)
}
return uniqId
fun privateDeclarationSignature(declaration: IrDeclaration, builder: () -> IdSignature): IdSignature {
assert(declaration.isLocalDeclaration())
return table.getOrPut(declaration) { builder() }
}
private tailrec fun IrDeclaration.isMetadataDeclaration(isTypeParameter: Boolean): Boolean {
if (this is IrValueDeclaration || this is IrField) {
return false
}
if (origin == IrDeclarationOrigin.FAKE_OVERRIDE || origin == IrDeclarationOrigin.ENUM_CLASS_SPECIAL_MEMBER) {
return false
}
if (!isTypeParameter) {
if (this is IrSimpleFunction) {
if (correspondingPropertySymbol != null)
return false
}
}
if (this is IrDeclarationWithVisibility) {
if (visibility == Visibilities.LOCAL) {
return false
}
}
if (this is IrLazyDeclarationBase) return false
if (parent is IrPackageFragment) return true
return (parent as IrDeclaration).isMetadataDeclaration(this is IrTypeParameter || isTypeParameter)
fun signatureByDeclaration(declaration: IrDeclaration): IdSignature {
return computeSignatureByDeclaration(declaration)
}
}
// This is what we pre-populate tables with
val IrBuiltIns.knownBuiltins
get() = irBuiltInsSymbols
val IrBuiltIns.knownBuiltins: List<IrDeclaration>
get() = packageFragment.declarations
@@ -1,22 +0,0 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.backend.common.serialization
enum class DescriptorReferenceFlags {
IS_FAKE_OVERRIDE,
IS_BACKING_FIELD,
IS_GETTER,
IS_SETTER,
IS_DEFAULT_CONSTRUCTOR,
IS_ENUM_ENTRY,
IS_ENUM_SPECIAL,
IS_TYPE_PARAMETER,
IS_EXPECT;
fun encode(isSet: Boolean): Int = if (isSet) 1 shl ordinal else 0
fun decode(flags: Int): Boolean = (flags and (1 shl ordinal) != 0)
}
@@ -1,209 +0,0 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.backend.common.serialization
import org.jetbrains.kotlin.builtins.functions.FunctionClassDescriptor
import org.jetbrains.kotlin.builtins.functions.FunctionInvokeDescriptor
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns
import org.jetbrains.kotlin.ir.util.KotlinMangler
import org.jetbrains.kotlin.ir.util.UniqId
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
import org.jetbrains.kotlin.resolve.multiplatform.ExpectedActualResolver
import org.jetbrains.kotlin.resolve.scopes.MemberScope
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedClassDescriptor
// This is all information needed to find a descriptor in the
// tree of deserialized descriptors. Think of it as base + offset.
// packageFqName + classFqName + index allow to localize some deserialized descriptor.
// Then the rest of the fields allow to find the needed descriptor relative to the one with index.
abstract class DescriptorReferenceDeserializer(
val currentModule: ModuleDescriptor,
val mangler: KotlinMangler,
val builtIns: IrBuiltIns?,
val resolvedForwardDeclarations: MutableMap<UniqId, UniqId>
) : DescriptorUniqIdAware {
protected open fun resolveSpecialDescriptor(fqn: FqName) = builtIns!!.builtIns.getBuiltInClassByFqName(fqn)
open fun checkIfSpecialDescriptorId(id: Long) = with(mangler) { id.isSpecial }
protected open fun getDescriptorIdOrNull(descriptor: DeclarationDescriptor) =
if (isBuiltInFunction(descriptor)) {
val uniqName = when (descriptor) {
is FunctionClassDescriptor -> KotlinMangler.functionClassSymbolName(descriptor.name)
is FunctionInvokeDescriptor -> KotlinMangler.functionInvokeSymbolName(descriptor.containingDeclaration.name)
else -> error("Unexpected descriptor type: $descriptor")
}
with(mangler) { uniqName.hashMangle }
} else null
protected fun getContributedDescriptors(packageFqName: FqName, name: String): Collection<DeclarationDescriptor> {
val memberScope = currentModule.getPackage(packageFqName).memberScope
return getContributedDescriptors(memberScope, name)
}
protected fun getContributedDescriptors(memberScope: MemberScope, name: String): Collection<DeclarationDescriptor> {
val contributedNameString = if (name.startsWith("<get-") || name.startsWith("<set-")) {
name.substring(5, name.length - 1) // FIXME: rework serialization format.
} else {
name
}
val contributedName = Name.identifier(contributedNameString)
return memberScope.getContributedFunctions(contributedName, NoLookupLocation.FROM_BACKEND) +
memberScope.getContributedVariables(contributedName, NoLookupLocation.FROM_BACKEND) +
listOfNotNull(memberScope.getContributedClassifier(contributedName, NoLookupLocation.FROM_BACKEND))
}
protected class ClassMembers(val defaultConstructor: ClassConstructorDescriptor?,
val members: Map<Long, DeclarationDescriptor>,
val realMembers: Map<Long, DeclarationDescriptor>)
private fun computeUniqIdIndex(descriptor: DeclarationDescriptor) = descriptor.getUniqId() ?: getDescriptorIdOrNull(descriptor)
protected fun getMembers(members: Collection<DeclarationDescriptor>): ClassMembers {
val allMembersMap = mutableMapOf<Long, DeclarationDescriptor>()
val realMembersMap = mutableMapOf<Long, DeclarationDescriptor>()
var classConstructorDescriptor: ClassConstructorDescriptor? = null
members.forEach { member ->
if (member is ClassConstructorDescriptor)
classConstructorDescriptor = member
val realMembers =
if (member is CallableMemberDescriptor && member.kind == CallableMemberDescriptor.Kind.FAKE_OVERRIDE)
member.resolveFakeOverrideMaybeAbstract()
else
setOf(member)
computeUniqIdIndex(member)?.let { allMembersMap[it] = member }
realMembers.mapNotNull { computeUniqIdIndex(it) }.forEach { realMembersMap[it] = member }
}
return ClassMembers(classConstructorDescriptor, allMembersMap, realMembersMap)
}
// TODO: the real findExpects() returns a list.
// Need to account for multiple expects here.
private fun MemberDescriptor.toExpect() =
if (this.isExpect)
this
else
ExpectedActualResolver.findExpectedForActual(
this,
currentModule,
{ true }
)?.get(ExpectedActualResolver.Compatibility.Compatible)?.single()
private fun Collection<DeclarationDescriptor>.toExpects() = this.map { (it as MemberDescriptor).toExpect() }.filterNotNull().distinct()
open fun deserializeDescriptorReference(
packageFqName: FqName,
classFqName: FqName,
name: String,
flags: Int,
index: Long?
): DeclarationDescriptor {
val protoIndex = index
val (clazz, members) = if (classFqName.isRoot) {
Pair(null,
getContributedDescriptors(packageFqName, name).let {
if (DescriptorReferenceFlags.IS_EXPECT.decode(flags)) it.toExpects() else it
}
)
} else {
val classifier = (currentModule.findClassifierAcrossModuleDependencies(ClassId(packageFqName, classFqName, false)) as? MemberDescriptor)
?: error("Could not find class across modules: $packageFqName/$classFqName")
val expect = if (DescriptorReferenceFlags.IS_EXPECT.decode(flags)) {
classifier.toExpect()
} else null
val expectOrActualClass = (expect as ClassDescriptor?) ?: (classifier as ClassDescriptor) // TODO: OMG!!!
Pair(expectOrActualClass, getContributedDescriptors(expectOrActualClass.unsubstitutedMemberScope, name) + expectOrActualClass.getConstructors())
}
// TODO: This is still native specific. Eliminate.
val fqnString = packageFqName.asString()
if (fqnString.startsWith("cnames.") || fqnString.startsWith("objcnames.")) {
val descriptor =
currentModule.findClassAcrossModuleDependencies(ClassId(packageFqName, FqName(name), false))!!
if (!descriptor.fqNameUnsafe.asString().startsWith("cnames") && !descriptor.fqNameUnsafe.asString().startsWith(
"objcnames"
)
) {
if (descriptor is DeserializedClassDescriptor) {
val uniqId = UniqId(descriptor.getUniqId()!!)
val newKey = uniqId
val oldKey = UniqId(protoIndex!!)
resolvedForwardDeclarations.put(oldKey, newKey)
} else {
/* ??? */
}
}
return descriptor
}
if (DescriptorReferenceFlags.IS_ENUM_ENTRY.decode(flags)) {
val memberScope = (clazz as DeserializedClassDescriptor).getUnsubstitutedMemberScope()
return memberScope.getContributedClassifier(Name.identifier(name), NoLookupLocation.FROM_BACKEND)!!
}
if (DescriptorReferenceFlags.IS_ENUM_SPECIAL.decode(flags)) {
return clazz!!.getStaticScope()
.getContributedFunctions(Name.identifier(name), NoLookupLocation.FROM_BACKEND).single()
}
if (DescriptorReferenceFlags.IS_TYPE_PARAMETER.decode(flags)) {
for (m in (listOfNotNull(clazz) + members)) {
val typeParameters = when (m) {
is PropertyDescriptor -> m.typeParameters
is ClassDescriptor -> m.declaredTypeParameters
is SimpleFunctionDescriptor -> m.typeParameters
is ClassConstructorDescriptor -> m.typeParameters
else -> emptyList()
}
typeParameters.firstOrNull { it.getUniqId() == index }?.let { return it }
}
}
if (protoIndex?.let { checkIfSpecialDescriptorId(it) } == true) {
return resolveSpecialDescriptor(packageFqName.child(Name.identifier(name)))
}
val membersWithIndices = getMembers(members)
val result = when {
DescriptorReferenceFlags.IS_DEFAULT_CONSTRUCTOR.decode(flags) -> membersWithIndices.defaultConstructor
else -> {
val map = if (DescriptorReferenceFlags.IS_FAKE_OVERRIDE.decode(flags)) membersWithIndices.realMembers else membersWithIndices.members
map[protoIndex]?.let { member ->
when {
member is PropertyDescriptor && DescriptorReferenceFlags.IS_SETTER.decode(flags) -> member.setter!!
member is PropertyDescriptor && DescriptorReferenceFlags.IS_GETTER.decode(flags) -> member.getter!!
else -> member
}
}
}
} ?:
error("Could not find serialized descriptor for index: ${index} ${packageFqName},${classFqName},${name}")
// TODO: why we don't have "expect" bit on all the expect declarations?
//if (DescriptorReferenceFlags.IS_EXPECT.decode(flags)) assert(if (result is ClassConstructorDescriptor) result.constructedClass.isExpect() else result.isExpectMember) {
// "expected expect, found $result"
//}
return result
}
}
@@ -5,40 +5,14 @@
package org.jetbrains.kotlin.backend.common.serialization
import org.jetbrains.kotlin.builtins.functions.FunctionInvokeDescriptor
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor
import org.jetbrains.kotlin.ir.declarations.IrClass
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
import org.jetbrains.kotlin.ir.util.fqNameWhenAvailable
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.util.OperatorNameConventions
import java.util.regex.Pattern
private val functionPattern = Pattern.compile("^K?(Suspend)?Function\\d+$")
internal val functionPattern = Pattern.compile("^K?(Suspend)?Function\\d+$")
private val kotlinFqn = FqName("kotlin")
internal val kotlinFqn = FqName("kotlin")
internal val kotlinCoroutinesFqn = kotlinFqn.child(Name.identifier("coroutines"))
internal val kotlinReflectFqn = kotlinFqn.child(Name.identifier("reflect"))
private val functionalPackages =
listOf(kotlinFqn, kotlinFqn.child(Name.identifier("coroutines")), kotlinFqn.child(Name.identifier("reflect")))
fun isBuiltInFunction(value: IrDeclaration): Boolean = when (value) {
is IrSimpleFunction ->
value.name == OperatorNameConventions.INVOKE && (value.parent as? IrClass)?.let { isBuiltInFunction(it) } == true
is IrClass ->
value.fqNameWhenAvailable?.parent() in functionalPackages &&
value.name.asString().let { functionPattern.matcher(it).find() }
else -> false
}
fun isBuiltInFunction(value: DeclarationDescriptor): Boolean = when (value) {
is FunctionInvokeDescriptor -> isBuiltInFunction(value.containingDeclaration)
is ClassDescriptor -> {
val fqn = (value.containingDeclaration as? PackageFragmentDescriptor)?.fqName
functionalPackages.any { it == fqn } && value.name.asString().let { functionPattern.matcher(it).find() }
}
else -> false
}
internal val functionalPackages = listOf(kotlinFqn, kotlinCoroutinesFqn, kotlinReflectFqn)
@@ -66,25 +66,6 @@ fun IrSimpleFunction.resolveFakeOverride(allowAbstract: Boolean = false): IrSimp
}
}
/**
* Implementation of given method.
*
* TODO: this method is actually a part of resolve and probably duplicates another one
*/
internal fun IrSimpleFunction.resolveFakeOverrideMaybeAbstract() = this.resolveFakeOverride(allowAbstract = true)
internal fun IrProperty.resolveFakeOverrideMaybeAbstract(): IrProperty =
this.getter!!.resolveFakeOverrideMaybeAbstract().correspondingPropertySymbol!!.owner
/**
* TODO: This method can be simplified if the "overriddenSymbols" list of an IrField always includes only one element.
* Currently it's not the case for some cinterop libraries (e.g. Foundation). In these libraries interfaces containing
* final properties with external getters are created (corresponding compiler error is suppressed). Due to KT-33081
* such a property gets a backing field and a field of a class implementing such interfaces can have several elements
* in the overriddenSymbols list.
*/
internal fun IrField.resolveFakeOverride(): IrField = getRealSupers().first()
val IrSimpleFunction.target: IrSimpleFunction
get() = (if (modality == Modality.ABSTRACT) this else resolveFakeOverride()).original
@@ -11,38 +11,30 @@ import org.jetbrains.kotlin.backend.common.ir.ir2string
import org.jetbrains.kotlin.backend.common.peek
import org.jetbrains.kotlin.backend.common.pop
import org.jetbrains.kotlin.backend.common.push
import org.jetbrains.kotlin.backend.common.serialization.encodings.*
import org.jetbrains.kotlin.backend.common.serialization.proto.IrConst.ValueCase.*
import org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration.DeclaratorCase.*
import org.jetbrains.kotlin.backend.common.serialization.proto.IrOperation.OperationCase.*
import org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement.StatementCase
import org.jetbrains.kotlin.backend.common.serialization.proto.IrType.KindCase.*
import org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeArgument.KindCase.STAR
import org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeArgument.KindCase.TYPE
import org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature.IdsigCase.*
import org.jetbrains.kotlin.backend.common.serialization.proto.IrVarargElement.VarargElementCase
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.ir.IrElement
import org.jetbrains.kotlin.ir.IrStatement
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.declarations.impl.*
import org.jetbrains.kotlin.ir.descriptors.*
import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.expressions.impl.*
import org.jetbrains.kotlin.ir.symbols.*
import org.jetbrains.kotlin.ir.symbols.impl.IrTypeParameterSymbolImpl
import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.types.impl.*
import org.jetbrains.kotlin.ir.util.SymbolTable
import org.jetbrains.kotlin.ir.util.render
import org.jetbrains.kotlin.ir.util.*
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedTypeParameterDescriptor
import org.jetbrains.kotlin.types.Variance
import org.jetbrains.kotlin.backend.common.serialization.proto.ClassKind as ProtoClassKind
import org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference as ProtoDescriptorReference
import org.jetbrains.kotlin.backend.common.serialization.proto.IrAnonymousInit as ProtoAnonymousInit
import org.jetbrains.kotlin.backend.common.serialization.proto.IrBlock as ProtoBlock
//import org.jetbrains.kotlin.backend.common.serialization.proto.IrDataIndex as ProtoBodyIndex
import org.jetbrains.kotlin.backend.common.serialization.proto.IrBlockBody as ProtoBlockBody
import org.jetbrains.kotlin.backend.common.serialization.proto.IrBranch as ProtoBranch
import org.jetbrains.kotlin.backend.common.serialization.proto.IrBreak as ProtoBreak
@@ -57,7 +49,6 @@ import org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall
import org.jetbrains.kotlin.backend.common.serialization.proto.IrContinue as ProtoContinue
import org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration as ProtoDeclaration
import org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationBase as ProtoDeclarationBase
import org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin as ProtoDeclarationOrigin
import org.jetbrains.kotlin.backend.common.serialization.proto.IrDelegatingConstructorCall as ProtoDelegatingConstructorCall
import org.jetbrains.kotlin.backend.common.serialization.proto.IrDoWhile as ProtoDoWhile
import org.jetbrains.kotlin.backend.common.serialization.proto.IrDynamicMemberExpression as ProtoDynamicMemberExpression
@@ -89,9 +80,7 @@ import org.jetbrains.kotlin.backend.common.serialization.proto.IrSetVariable as
import org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType as ProtoSimpleType
import org.jetbrains.kotlin.backend.common.serialization.proto.IrSpreadElement as ProtoSpreadElement
import org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement as ProtoStatement
import org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin as ProtoStatementOrigin
import org.jetbrains.kotlin.backend.common.serialization.proto.IrStringConcat as ProtoStringConcat
//import org.jetbrains.kotlin.backend.common.serialization.proto.IrDataIndex as ProtoSymbolIndex
import org.jetbrains.kotlin.backend.common.serialization.proto.IrSyntheticBody as ProtoSyntheticBody
import org.jetbrains.kotlin.backend.common.serialization.proto.IrSyntheticBodyKind as ProtoSyntheticBodyKind
import org.jetbrains.kotlin.backend.common.serialization.proto.IrThrow as ProtoThrow
@@ -99,12 +88,9 @@ import org.jetbrains.kotlin.backend.common.serialization.proto.IrTry as ProtoTry
import org.jetbrains.kotlin.backend.common.serialization.proto.IrType as ProtoType
import org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAbbreviation as ProtoTypeAbbreviation
import org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAlias as ProtoTypeAlias
import org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeArgument as ProtoTypeArgument
//import org.jetbrains.kotlin.backend.common.serialization.proto.IrDataIndex as ProtoTypeIndex
import org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeOp as ProtoTypeOp
import org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeOperator as ProtoTypeOperator
import org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter as ProtoTypeParameter
import org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeVariance as ProtoTypeVariance
import org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter as ProtoValueParameter
import org.jetbrains.kotlin.backend.common.serialization.proto.IrVararg as ProtoVararg
import org.jetbrains.kotlin.backend.common.serialization.proto.IrVarargElement as ProtoVarargElement
@@ -113,32 +99,24 @@ import org.jetbrains.kotlin.backend.common.serialization.proto.IrWhen as ProtoWh
import org.jetbrains.kotlin.backend.common.serialization.proto.IrWhile as ProtoWhile
import org.jetbrains.kotlin.backend.common.serialization.proto.Loop as ProtoLoop
import org.jetbrains.kotlin.backend.common.serialization.proto.MemberAccessCommon as ProtoMemberAccessCommon
import org.jetbrains.kotlin.backend.common.serialization.proto.ModalityKind as ProtoModalityKind
//import org.jetbrains.kotlin.backend.common.serialization.proto.IrDataIndex as ProtoStringIndex
import org.jetbrains.kotlin.backend.common.serialization.proto.TypeArguments as ProtoTypeArguments
import org.jetbrains.kotlin.backend.common.serialization.proto.Visibility as ProtoVisibility
//import org.jetbrains.kotlin.backend.common.serialization.proto.FqName as ProtoFqName
import org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature as ProtoIdSignature
import org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature as ProtoPublicIdSignature
import org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature as ProtoAccessorIdSignature
import org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature as ProtoFileLocalIdSignature
// TODO: This code still has some uses of descriptors:
// 1. We use descriptors as keys for symbolTable -- probably symbol table related code should be refactored out from
// the deserializer.
// 2. Properties use descriptors but not symbols -- that causes lots of assymmetry all around.
// 3. Declarations are provided with wrapped descriptors. That is probably a legitimate descriptor use.
abstract class IrFileDeserializer(val logger: LoggingContext, val builtIns: IrBuiltIns, val symbolTable: SymbolTable) {
abstract class IrFileDeserializer(
val logger: LoggingContext,
val builtIns: IrBuiltIns,
val symbolTable: SymbolTable
) {
abstract fun deserializeIrSymbol(index: Int): IrSymbol
abstract fun deserializeIrSymbolToDeclare(code: Long): Pair<IrSymbol, IdSignature>
abstract fun deserializeIrSymbol(code: Long): IrSymbol
abstract fun deserializeIrType(index: Int): IrType
abstract fun deserializeDescriptorReference(proto: ProtoDescriptorReference): DeclarationDescriptor
abstract fun deserializeIdSignature(index: Int): IdSignature
abstract fun deserializeString(index: Int): String
abstract fun deserializeExpressionBody(index: Int): IrExpression
abstract fun deserializeStatementBody(index: Int): IrElement
abstract fun deserializeLoopHeader(loopIndex: Int, loopBuilder: () -> IrLoopBase): IrLoopBase
abstract fun referenceIrSymbol(symbol: IrSymbol, signature: IdSignature)
private val parentsStack = mutableListOf<IrDeclarationParent>()
fun deserializeFqName(fqn: List<Int>): FqName {
@@ -152,30 +130,12 @@ abstract class IrFileDeserializer(
return Name.guessByFirstCharacter(name)
}
private fun deserializeTypeArguments(proto: ProtoTypeArguments): List<IrType> {
logger.log { "### deserializeTypeArguments" }
val result = mutableListOf<IrType>()
proto.typeArgumentList.forEach { typeProto ->
val type = deserializeIrType(typeProto)
result.add(type)
logger.log { "$type" }
}
return result
}
private fun deserializeIrTypeArgument(proto: Long): IrTypeArgument {
val encoding = BinaryTypeProjection.decode(proto)
private fun deserializeIrTypeVariance(variance: ProtoTypeVariance) = when (variance) {
ProtoTypeVariance.IN -> Variance.IN_VARIANCE
ProtoTypeVariance.OUT -> Variance.OUT_VARIANCE
ProtoTypeVariance.INV -> Variance.INVARIANT
}
private fun deserializeIrTypeArgument(proto: ProtoTypeArgument) = when (proto.kindCase) {
STAR -> IrStarProjectionImpl
TYPE -> makeTypeProjection(
deserializeIrType(proto.type.type), deserializeIrTypeVariance(proto.type.variance)
)
else -> TODO("Unexpected projection kind")
if (encoding.isStarProjection) return IrStarProjectionImpl
return makeTypeProjection(deserializeIrType(encoding.typeIndex), encoding.variance)
}
fun deserializeAnnotations(annotations: List<ProtoConstructorCall>): List<IrConstructorCall> {
@@ -231,7 +191,51 @@ abstract class IrFileDeserializer(
SIMPLE -> deserializeSimpleType(proto.simple)
DYNAMIC -> deserializeDynamicType(proto.dynamic)
ERROR -> deserializeErrorType(proto.error)
else -> TODO("Unexpected IrType kind: ${proto.kindCase}")
else -> error("Unexpected IrType kind: ${proto.kindCase}")
}
}
/* -------------------------------------------------------------- */
// TODO: Think about isolating id signature related logic behind corresponding interface
private fun deserializePublicIdSignature(proto: ProtoPublicIdSignature): IdSignature.PublicSignature {
val pkg = deserializeFqName(proto.packageFqNameList)
val cls = deserializeFqName(proto.classFqNameList)
val memberId = if (proto.hasMemberUniqId()) proto.memberUniqId else null
return IdSignature.PublicSignature(pkg, cls, memberId, proto.flags)
}
private fun deserializeAccessorIdSignature(proto: ProtoAccessorIdSignature): IdSignature.AccessorSignature {
val propertySignature = deserializeIdSignature(proto.propertySignature)
require(propertySignature is IdSignature.PublicSignature) { "For public accessor corresponding property supposed to be public as well" }
val name = deserializeString(proto.name)
val hash = proto.accessorHashId
val mask = proto.flags
val accessorSignature = with(propertySignature) {
IdSignature.PublicSignature(packageFqn, classFqn.child(Name.special(name)), hash, mask)
}
return IdSignature.AccessorSignature(propertySignature, accessorSignature)
}
private fun deserializeFileLocalIdSignature(proto: ProtoFileLocalIdSignature): IdSignature.FileLocalSignature {
return IdSignature.FileLocalSignature(deserializeIdSignature(proto.container), proto.localId)
}
private fun deserializeScopeLocalIdSignature(proto: Int): IdSignature.ScopeLocalDeclaration {
return IdSignature.ScopeLocalDeclaration(proto)
}
fun deserializeSignatureData(proto: ProtoIdSignature): IdSignature {
return when (proto.idsigCase) {
PUBLIC_SIG -> deserializePublicIdSignature(proto.publicSig)
ACCESSOR_SIG -> deserializeAccessorIdSignature(proto.accessorSig)
PRIVATE_SIG -> deserializeFileLocalIdSignature(proto.privateSig)
SCOPED_LOCAL_SIG -> deserializeScopeLocalIdSignature(proto.scopedLocalSig)
else -> error("Unexpected IdSignature kind: ${proto.idsigCase}")
}
}
@@ -276,8 +280,9 @@ abstract class IrFileDeserializer(
}
fun deserializeStatement(proto: ProtoStatement): IrElement {
val start = proto.coordinates.startOffset
val end = proto.coordinates.endOffset
val coordinates = BinaryCoordinates.decode(proto.coordinates)
val start = coordinates.startOffset
val end = coordinates.endOffset
val element = when (proto.statementCase) {
StatementCase.BLOCK_BODY //proto.hasBlockBody()
-> deserializeBlockBody(proto.blockBody, start, end)
@@ -303,7 +308,7 @@ abstract class IrFileDeserializer(
private fun deserializeBlock(proto: ProtoBlock, start: Int, end: Int, type: IrType): IrBlock {
val statements = mutableListOf<IrStatement>()
val statementProtos = proto.statementList
val origin = if (proto.hasOrigin()) deserializeIrStatementOrigin(proto.origin) else null
val origin = if (proto.hasOriginName()) deserializeIrStatementOrigin(proto.originName) else null
statementProtos.forEach {
statements.add(deserializeStatement(it) as IrStatement)
@@ -321,8 +326,8 @@ abstract class IrFileDeserializer(
}
}
deserializeTypeArguments(proto.typeArguments).forEachIndexed { index, type ->
access.putTypeArgument(index, type)
proto.typeArgumentList.mapIndexed { i, arg ->
access.putTypeArgument(i, deserializeIrType(arg))
}
if (proto.hasDispatchReceiver()) {
@@ -349,7 +354,7 @@ abstract class IrFileDeserializer(
val symbol = deserializeIrSymbol(proto.symbol) as IrConstructorSymbol
return IrConstructorCallImpl(
start, end, type,
symbol, typeArgumentsCount = proto.memberAccess.typeArguments.typeArgumentCount,
symbol, typeArgumentsCount = proto.memberAccess.typeArgumentCount,
constructorTypeArgumentsCount = proto.constructorTypeArgumentsCount,
valueArgumentsCount = proto.memberAccess.valueArgumentCount
).also {
@@ -364,13 +369,13 @@ abstract class IrFileDeserializer(
deserializeIrSymbol(proto.`super`) as IrClassSymbol
} else null
val origin = if (proto.hasOrigin()) deserializeIrStatementOrigin(proto.origin) else null
val origin = if (proto.hasOriginName()) deserializeIrStatementOrigin(proto.originName) else null
val call: IrCall =
// TODO: implement the last three args here.
IrCallImpl(
start, end, type,
symbol, proto.memberAccess.typeArguments.typeArgumentCount,
symbol, proto.memberAccess.typeArgumentCount,
proto.memberAccess.valueArgumentList.size,
origin,
superSymbol
@@ -382,7 +387,7 @@ abstract class IrFileDeserializer(
private fun deserializeComposite(proto: ProtoComposite, start: Int, end: Int, type: IrType): IrComposite {
val statements = mutableListOf<IrStatement>()
val statementProtos = proto.statementList
val origin = if (proto.hasOrigin()) deserializeIrStatementOrigin(proto.origin) else null
val origin = if (proto.hasOriginName()) deserializeIrStatementOrigin(proto.originName) else null
statementProtos.forEach {
statements.add(deserializeStatement(it) as IrStatement)
@@ -401,8 +406,8 @@ abstract class IrFileDeserializer(
end,
builtIns.unitType,
symbol,
proto.memberAccess.typeArguments.typeArgumentCount,
proto.memberAccess.valueArgumentList.size
proto.memberAccess.typeArgumentCount,
proto.memberAccess.valueArgumentCount
)
deserializeMemberAccessCommon(call, proto.memberAccess)
@@ -422,8 +427,8 @@ abstract class IrFileDeserializer(
end,
builtIns.unitType,
symbol,
proto.memberAccess.typeArguments.typeArgumentList.size,
proto.memberAccess.valueArgumentList.size
proto.memberAccess.typeArgumentCount,
proto.memberAccess.valueArgumentCount
)
deserializeMemberAccessCommon(call, proto.memberAccess)
return call
@@ -438,7 +443,7 @@ abstract class IrFileDeserializer(
IrFunctionExpressionImpl(
start, end, type,
deserializeIrFunction(functionExpression.function),
deserializeIrStatementOrigin(functionExpression.origin)
deserializeIrStatementOrigin(functionExpression.originName)
)
private fun deserializeFunctionReference(
@@ -447,14 +452,15 @@ abstract class IrFileDeserializer(
): IrFunctionReference {
val symbol = deserializeIrSymbol(proto.symbol) as IrFunctionSymbol
val origin = if (proto.hasOrigin()) deserializeIrStatementOrigin(proto.origin) else null
val reflectionTarget = if (proto.hasReflectionTarget()) deserializeIrSymbol(proto.reflectionTarget) as IrFunctionSymbol else null
val origin = if (proto.hasOriginName()) deserializeIrStatementOrigin(proto.originName) else null
val reflectionTarget =
if (proto.hasReflectionTargetSymbol()) deserializeIrSymbol(proto.reflectionTargetSymbol) as IrFunctionSymbol else null
val callable = IrFunctionReferenceImpl(
start,
end,
type,
symbol,
proto.memberAccess.typeArguments.typeArgumentCount,
proto.memberAccess.typeArgumentCount,
proto.memberAccess.valueArgumentCount,
reflectionTarget,
origin
@@ -472,7 +478,7 @@ abstract class IrFileDeserializer(
private fun deserializeGetField(proto: ProtoGetField, start: Int, end: Int, type: IrType): IrGetField {
val access = proto.fieldAccess
val symbol = deserializeIrSymbol(access.symbol) as IrFieldSymbol
val origin = if (proto.hasOrigin()) deserializeIrStatementOrigin(proto.origin) else null
val origin = if (proto.hasOriginName()) deserializeIrStatementOrigin(proto.originName) else null
val superQualifier = if (access.hasSuper()) {
deserializeIrSymbol(access.symbol) as IrClassSymbol
@@ -486,7 +492,7 @@ abstract class IrFileDeserializer(
private fun deserializeGetValue(proto: ProtoGetValue, start: Int, end: Int, type: IrType): IrGetValue {
val symbol = deserializeIrSymbol(proto.symbol) as IrValueSymbol
val origin = if (proto.hasOrigin()) deserializeIrStatementOrigin(proto.origin) else null
val origin = if (proto.hasOriginName()) deserializeIrStatementOrigin(proto.originName) else null
// TODO: origin!
return IrGetValueImpl(start, end, type, symbol, origin)
}
@@ -531,7 +537,7 @@ abstract class IrFileDeserializer(
val getter = deserializeIrSymbol(proto.getter) as IrSimpleFunctionSymbol
val setter = if (proto.hasSetter()) deserializeIrSymbol(proto.setter) as IrSimpleFunctionSymbol else null
val symbol = deserializeIrSymbol(proto.symbol) as IrLocalDelegatedPropertySymbol
val origin = if (proto.hasOrigin()) deserializeIrStatementOrigin(proto.origin) else null
val origin = if (proto.hasOriginName()) deserializeIrStatementOrigin(proto.originName) else null
return IrLocalDelegatedPropertyReferenceImpl(
start, end, type,
@@ -543,22 +549,19 @@ abstract class IrFileDeserializer(
)
}
private fun deserializePropertyReference(
proto: ProtoPropertyReference,
start: Int, end: Int, type: IrType
): IrPropertyReference {
private fun deserializePropertyReference(proto: ProtoPropertyReference, start: Int, end: Int, type: IrType): IrPropertyReference {
val symbol = deserializeIrSymbol(proto.symbol) as IrPropertySymbol
val field = if (proto.hasField()) deserializeIrSymbol(proto.field) as IrFieldSymbol else null
val getter = if (proto.hasGetter()) deserializeIrSymbol(proto.getter) as IrSimpleFunctionSymbol else null
val setter = if (proto.hasSetter()) deserializeIrSymbol(proto.setter) as IrSimpleFunctionSymbol else null
val origin = if (proto.hasOrigin()) deserializeIrStatementOrigin(proto.origin) else null
val origin = if (proto.hasOriginName()) deserializeIrStatementOrigin(proto.originName) else null
val callable = IrPropertyReferenceImpl(
start, end, type,
symbol,
proto.memberAccess.typeArguments.typeArgumentCount,
proto.memberAccess.typeArgumentCount,
field,
getter,
setter,
@@ -584,7 +587,7 @@ abstract class IrFileDeserializer(
deserializeExpression(access.receiver)
} else null
val value = deserializeExpression(proto.value)
val origin = if (proto.hasOrigin()) deserializeIrStatementOrigin(proto.origin) else null
val origin = if (proto.hasOriginName()) deserializeIrStatementOrigin(proto.originName) else null
return IrSetFieldImpl(start, end, symbol, receiver, value, builtIns.unitType, origin, superQualifier)
}
@@ -592,21 +595,17 @@ abstract class IrFileDeserializer(
private fun deserializeSetVariable(proto: ProtoSetVariable, start: Int, end: Int): IrSetVariable {
val symbol = deserializeIrSymbol(proto.symbol) as IrVariableSymbol
val value = deserializeExpression(proto.value)
val origin = if (proto.hasOrigin()) deserializeIrStatementOrigin(proto.origin) else null
val origin = if (proto.hasOriginName()) deserializeIrStatementOrigin(proto.originName) else null
return IrSetVariableImpl(start, end, builtIns.unitType, symbol, value, origin)
}
private fun deserializeSpreadElement(proto: ProtoSpreadElement): IrSpreadElement {
val expression = deserializeExpression(proto.expression)
return IrSpreadElementImpl(proto.coordinates.startOffset, proto.coordinates.endOffset, expression)
val coordinates = BinaryCoordinates.decode(proto.coordinates)
return IrSpreadElementImpl(coordinates.startOffset, coordinates.endOffset, expression)
}
private fun deserializeStringConcat(
proto: ProtoStringConcat,
start: Int,
end: Int,
type: IrType
): IrStringConcatenation {
private fun deserializeStringConcat(proto: ProtoStringConcat, start: Int, end: Int, type: IrType): IrStringConcatenation {
val argumentProtos = proto.argumentList
val arguments = mutableListOf<IrExpression>()
@@ -686,7 +685,7 @@ abstract class IrFileDeserializer(
private fun deserializeWhen(proto: ProtoWhen, start: Int, end: Int, type: IrType): IrWhen {
val branches = mutableListOf<IrBranch>()
val origin = if (proto.hasOrigin()) deserializeIrStatementOrigin(proto.origin) else null
val origin = if (proto.hasOriginName()) deserializeIrStatementOrigin(proto.originName) else null
proto.branchList.forEach {
branches.add(deserializeStatement(it) as IrBranch)
@@ -711,16 +710,22 @@ abstract class IrFileDeserializer(
// we create the loop before deserializing the body, so that
// IrBreak statements have something to put into 'loop' field.
private fun deserializeDoWhile(proto: ProtoDoWhile, start: Int, end: Int, type: IrType) =
deserializeLoop(proto.loop, deserializeLoopHeader(proto.loop.loopId) {
val origin = if (proto.loop.hasOrigin()) deserializeIrStatementOrigin(proto.loop.origin) else null
IrDoWhileLoopImpl(start, end, type, origin)
})
deserializeLoop(
proto.loop,
deserializeLoopHeader(proto.loop.loopId) {
val origin = if (proto.loop.hasOriginName()) deserializeIrStatementOrigin(proto.loop.originName) else null
IrDoWhileLoopImpl(start, end, type, origin)
}
)
private fun deserializeWhile(proto: ProtoWhile, start: Int, end: Int, type: IrType) =
deserializeLoop(proto.loop, deserializeLoopHeader(proto.loop.loopId) {
val origin = if (proto.loop.hasOrigin()) deserializeIrStatementOrigin(proto.loop.origin) else null
IrWhileLoopImpl(start, end, type, origin)
})
deserializeLoop(
proto.loop,
deserializeLoopHeader(proto.loop.loopId) {
val origin = if (proto.loop.hasOriginName()) deserializeIrStatementOrigin(proto.loop.originName) else null
IrWhileLoopImpl(start, end, type, origin)
}
)
private fun deserializeDynamicMemberExpression(
proto: ProtoDynamicMemberExpression,
@@ -877,8 +882,9 @@ abstract class IrFileDeserializer(
}
fun deserializeExpression(proto: ProtoExpression): IrExpression {
val start = proto.coordinates.startOffset
val end = proto.coordinates.endOffset
val coordinates = BinaryCoordinates.decode(proto.coordinates)
val start = coordinates.startOffset
val end = coordinates.endOffset
val type = deserializeIrType(proto.type)
val operation = proto.operation
val expression = deserializeOperation(operation, start, end, type)
@@ -901,58 +907,78 @@ abstract class IrFileDeserializer(
private inline fun <T> withDeserializedIrDeclarationBase(
proto: ProtoDeclarationBase,
block: (IrSymbol, Int, Int, IrDeclarationOrigin) -> T
block: (IrSymbol, IdSignature, Int, Int, IrDeclarationOrigin, Long) -> T
): T where T : IrDeclaration, T : IrSymbolOwner {
val (s, uid) = deserializeIrSymbolToDeclare(proto.symbol)
val coordinates = BinaryCoordinates.decode(proto.coordinates)
val result = block(
deserializeIrSymbol(proto.symbol),
proto.coordinates.startOffset, proto.coordinates.endOffset,
deserializeIrDeclarationOrigin(proto.origin)
s,
uid,
coordinates.startOffset, coordinates.endOffset,
deserializeIrDeclarationOrigin(proto.originName), proto.flags
)
result.annotations += deserializeAnnotations(proto.annotationList)
result.parent = parentsStack.peek()!!
return result
}
private fun deserializeIrTypeParameter(proto: ProtoTypeParameter) =
withDeserializedIrDeclarationBase(proto.base) { symbol, startOffset, endOffset, origin ->
val name = deserializeName(proto.name)
val variance = deserializeIrTypeVariance(proto.variance)
private fun deserializeIrTypeParameter(proto: ProtoTypeParameter, index: Int, isGlobal: Boolean): IrTypeParameter {
val name = deserializeName(proto.name)
val coordinates = BinaryCoordinates.decode(proto.base.coordinates)
val flags = TypeParameterFlags.decode(proto.base.flags)
val descriptor = (symbol as IrTypeParameterSymbol).descriptor
if (descriptor is DeserializedTypeParameterDescriptor && descriptor.containingDeclaration is PropertyDescriptor && symbol.isBound) {
// TODO: Get rid of once new properties are implemented
IrTypeParameterImpl(startOffset, endOffset, origin, IrTypeParameterSymbolImpl(descriptor), name, proto.index, proto.isReified, variance)
val factory = { symbol: IrTypeParameterSymbol ->
IrTypeParameterImpl(
coordinates.startOffset,
coordinates.endOffset,
deserializeIrDeclarationOrigin(proto.base.originName),
symbol,
name,
index,
flags.isReified,
flags.variance
)
}
val sig: IdSignature
val result = symbolTable.run {
if (isGlobal) {
val p = deserializeIrSymbolToDeclare(proto.base.symbol)
val symbol = p.first
sig = p.second
val descriptor = (symbol as IrTypeParameterSymbol).descriptor
declareGlobalTypeParameterFromLinker(descriptor, sig, factory)
} else {
symbolTable.declareGlobalTypeParameter(UNDEFINED_OFFSET, UNDEFINED_OFFSET, irrelevantOrigin, descriptor) {
IrTypeParameterImpl(startOffset, endOffset, origin, it, name, proto.index, proto.isReified, variance)
}
}.apply {
proto.superTypeList.mapTo(superTypes) { deserializeIrType(it) }
(descriptor as? WrappedTypeParameterDescriptor)?.bind(this)
val symbolData = BinarySymbolData
.decode(proto.base.symbol)
sig = deserializeIdSignature(symbolData.signatureId)
val descriptor = WrappedTypeParameterDescriptor()
declareScopedTypeParameterFromLinker(descriptor, sig, factory)
}
}
private fun deserializeClassKind(kind: ProtoClassKind) = when (kind) {
ProtoClassKind.CLASS -> ClassKind.CLASS
ProtoClassKind.INTERFACE -> ClassKind.INTERFACE
ProtoClassKind.ENUM_CLASS -> ClassKind.ENUM_CLASS
ProtoClassKind.ENUM_ENTRY -> ClassKind.ENUM_ENTRY
ProtoClassKind.ANNOTATION_CLASS -> ClassKind.ANNOTATION_CLASS
ProtoClassKind.OBJECT -> ClassKind.OBJECT
(result.descriptor as? WrappedTypeParameterDescriptor)?.bind(result)
// make sure this symbol is known to linker
referenceIrSymbol(result.symbol, sig)
result.annotations += deserializeAnnotations(proto.base.annotationList)
result.parent = parentsStack.peek()!!
return result
}
private fun deserializeIrValueParameter(proto: ProtoValueParameter) =
withDeserializedIrDeclarationBase(proto.base) { symbol, startOffset, endOffset, origin ->
private fun deserializeIrValueParameter(proto: ProtoValueParameter, index: Int) =
withDeserializedIrDeclarationBase(proto.base) { symbol, _, startOffset, endOffset, origin, fcode ->
val flags = ValueParameterFlags.decode(fcode)
val nameAndType = BinaryNameAndType.decode(proto.nameType)
IrValueParameterImpl(
startOffset, endOffset, origin,
symbol as IrValueParameterSymbol,
deserializeName(proto.name),
proto.index,
deserializeIrType(proto.type),
deserializeName(nameAndType.nameIndex),
index,
deserializeIrType(nameAndType.typeIndex),
if (proto.hasVarargElementType()) deserializeIrType(proto.varargElementType) else null,
proto.isCrossinline,
proto.isNoinline
flags.isCrossInline,
flags.isNoInline
).apply {
if (proto.hasDefaultValue())
defaultValue = IrExpressionBodyImpl(deserializeExpressionBody(proto.defaultValue))
@@ -963,34 +989,31 @@ abstract class IrFileDeserializer(
}
private fun deserializeIrClass(proto: ProtoClass) =
withDeserializedIrDeclarationBase(proto.base) { symbol, startOffset, endOffset, origin ->
val modality = deserializeModality(proto.modality)
withDeserializedIrDeclarationBase(proto.base) { symbol, signature, startOffset, endOffset, origin, fcode ->
val flags = ClassFlags.decode(fcode)
symbolTable.declareClass(
UNDEFINED_OFFSET, UNDEFINED_OFFSET, irrelevantOrigin,
(symbol as IrClassSymbol).descriptor, modality
) {
symbolTable.declareClassFromLinker((symbol as IrClassSymbol).descriptor, signature) {
IrClassImpl(
startOffset, endOffset, origin,
it,
deserializeName(proto.name),
deserializeClassKind(proto.kind),
deserializeVisibility(proto.visibility),
modality,
isCompanion = proto.isCompanion,
isInner = proto.isInner,
isData = proto.isData,
isExternal = proto.isExternal,
isInline = proto.isInline,
isExpect = proto.isExpect,
isFun = proto.isFun
flags.kind,
flags.visibility,
flags.modality,
isCompanion = flags.isCompanion,
isInner = flags.isInner,
isData = flags.isData,
isExternal = flags.isExternal,
isInline = flags.isInline,
isExpect = flags.isExpect,
isFun = flags.isFun
)
}.usingParent {
proto.declarationContainer.declarationList.mapTo(declarations) { deserializeDeclaration(it) }
typeParameters = deserializeTypeParameters(proto.typeParameterList, true)
thisReceiver = deserializeIrValueParameter(proto.thisReceiver)
proto.declarationList.mapTo(declarations) { deserializeDeclaration(it) }
typeParameters = proto.typeParameters.typeParameterList.map { deserializeIrTypeParameter(it) }
thisReceiver = deserializeIrValueParameter(proto.thisReceiver, -1)
superTypes = proto.superTypeList.map { deserializeIrType(it) }
@@ -999,65 +1022,93 @@ abstract class IrFileDeserializer(
}
private fun deserializeIrTypeAlias(proto: ProtoTypeAlias) =
withDeserializedIrDeclarationBase(proto.base) { symbol, startOffset, endOffset, origin ->
symbolTable.declareTypeAlias((symbol as IrTypeAliasSymbol).descriptor) {
withDeserializedIrDeclarationBase(proto.base) { symbol, uniqId, startOffset, endOffset, origin, fcode ->
symbolTable.declareTypeAliasFromLinker((symbol as IrTypeAliasSymbol).descriptor, uniqId) {
val flags = TypeAliasFlags.decode(fcode)
val nameType = BinaryNameAndType.decode(proto.nameType)
IrTypeAliasImpl(
startOffset, endOffset,
it,
deserializeName(proto.name),
deserializeVisibility(proto.visibility),
deserializeIrType(proto.expandedType),
proto.isActual,
deserializeName(nameType.nameIndex),
flags.visibility,
deserializeIrType(nameType.typeIndex),
flags.isActual,
origin
)
}.usingParent {
typeParameters = proto.typeParameters.typeParameterList.map {
deserializeIrTypeParameter(it)
}
typeParameters = deserializeTypeParameters(proto.typeParameterList, true)
(descriptor as? WrappedTypeAliasDescriptor)?.bind(this)
}
}
private fun deserializeTypeParameters(protos: List<ProtoTypeParameter>, isGlobal: Boolean): List<IrTypeParameter> {
// NOTE: fun <C : MutableCollection<in T>, T : Any> Array<out T?>.filterNotNullTo(destination: C): C
val result = ArrayList<IrTypeParameter>(protos.size)
for (index in protos.indices) {
val proto = protos[index]
result.add(deserializeIrTypeParameter(proto, index, isGlobal))
}
for (i in protos.indices) {
protos[i].superTypeList.mapTo(result[i].superTypes) { deserializeIrType(it) }
}
return result
}
private fun deserializeValueParameters(protos: List<ProtoValueParameter>): List<IrValueParameter> {
val result = ArrayList<IrValueParameter>(protos.size)
for (i in protos.indices) {
result.add(deserializeIrValueParameter(protos[i], i))
}
return result
}
private inline fun <T : IrFunction> withDeserializedIrFunctionBase(
proto: ProtoFunctionBase,
block: (IrFunctionSymbol, Int, Int, IrDeclarationOrigin) -> T
) = withDeserializedIrDeclarationBase(proto.base) { symbol, startOffset, endOffset, origin ->
block(symbol as IrFunctionSymbol, startOffset, endOffset, origin).usingParent {
typeParameters = proto.typeParameters.typeParameterList.map { deserializeIrTypeParameter(it) }
valueParameters = proto.valueParameterList.map { deserializeIrValueParameter(it) }
if (proto.hasDispatchReceiver())
dispatchReceiverParameter = deserializeIrValueParameter(proto.dispatchReceiver)
if (proto.hasExtensionReceiver())
extensionReceiverParameter = deserializeIrValueParameter(proto.extensionReceiver)
if (proto.hasBody()) {
body = deserializeStatementBody(proto.body) as IrBody
block: (IrFunctionSymbol, IdSignature, Int, Int, IrDeclarationOrigin, Long) -> T
) = withDeserializedIrDeclarationBase(proto.base) { symbol, idSig, startOffset, endOffset, origin, fcode ->
symbolTable.withScope(symbol.descriptor) {
block(symbol as IrFunctionSymbol, idSig, startOffset, endOffset, origin, fcode).usingParent {
typeParameters = deserializeTypeParameters(proto.typeParameterList, false)
valueParameters = deserializeValueParameters(proto.valueParameterList)
val nameType = BinaryNameAndType.decode(proto.nameType)
returnType = deserializeIrType(nameType.typeIndex)
if (proto.hasDispatchReceiver())
dispatchReceiverParameter = deserializeIrValueParameter(proto.dispatchReceiver, -1)
if (proto.hasExtensionReceiver())
extensionReceiverParameter = deserializeIrValueParameter(proto.extensionReceiver, -1)
if (proto.hasBody()) {
body = deserializeStatementBody(proto.body) as IrBody
}
}
}
}
private fun deserializeIrFunction(proto: ProtoFunction) =
withDeserializedIrFunctionBase(proto.base) { symbol, startOffset, endOffset, origin ->
logger.log { "### deserializing IrFunction ${proto.base.name}" }
symbolTable.declareSimpleFunction(
UNDEFINED_OFFSET, UNDEFINED_OFFSET, irrelevantOrigin,
symbol.descriptor
) {
private fun deserializeIrFunction(proto: ProtoFunction): IrSimpleFunction {
return withDeserializedIrFunctionBase(proto.base) { symbol, idSig, startOffset, endOffset, origin, fcode ->
val flags = FunctionFlags.decode(fcode)
symbolTable.declareSimpleFunctionFromLinker(symbol.descriptor, idSig) {
val nameType = BinaryNameAndType.decode(proto.base.nameType)
IrFunctionImpl(
startOffset, endOffset, origin,
it,
deserializeName(proto.base.name),
deserializeVisibility(proto.base.visibility),
deserializeModality(proto.modality),
deserializeIrType(proto.base.returnType),
isInline = proto.base.isInline,
isExternal = proto.base.isExternal,
isTailrec = proto.isTailrec,
isSuspend = proto.isSuspend,
isExpect = proto.base.isExpect,
isFakeOverride = proto.isFakeOverride,
isOperator = proto.isOperator
deserializeName(nameType.nameIndex),
flags.visibility,
flags.modality,
IrUninitializedType,
flags.isInline,
flags.isExternal,
flags.isTailrec,
flags.isSuspend,
flags.isOperator,
flags.isExpect,
flags.isFakeOverride
)
}.apply {
overriddenSymbols = proto.overriddenList.map { deserializeIrSymbol(it) as IrSimpleFunctionSymbol }
@@ -1065,17 +1116,20 @@ abstract class IrFileDeserializer(
(descriptor as? WrappedSimpleFunctionDescriptor)?.bind(this)
}
}
}
private fun deserializeIrVariable(proto: ProtoVariable) =
withDeserializedIrDeclarationBase(proto.base) { symbol, startOffset, endOffset, origin ->
withDeserializedIrDeclarationBase(proto.base) { symbol, _, startOffset, endOffset, origin, fcode ->
val flags = LocalVariableFlags.decode(fcode)
val nameType = BinaryNameAndType.decode(proto.nameType)
IrVariableImpl(
startOffset, endOffset, origin,
symbol as IrVariableSymbol,
deserializeName(proto.name),
deserializeIrType(proto.type),
proto.isVar,
proto.isConst,
proto.isLateinit
deserializeName(nameType.nameIndex),
deserializeIrType(nameType.typeIndex),
flags.isVar,
flags.isConst,
flags.isLateinit
).apply {
if (proto.hasInitializer())
initializer = deserializeExpression(proto.initializer)
@@ -1085,13 +1139,8 @@ abstract class IrFileDeserializer(
}
private fun deserializeIrEnumEntry(proto: ProtoEnumEntry): IrEnumEntry =
withDeserializedIrDeclarationBase(proto.base) { symbol, startOffset, endOffset, origin ->
symbolTable.declareEnumEntry(
UNDEFINED_OFFSET,
UNDEFINED_OFFSET,
irrelevantOrigin,
(symbol as IrEnumEntrySymbol).descriptor
) {
withDeserializedIrDeclarationBase(proto.base) { symbol, uniqId, startOffset, endOffset, origin, _ ->
symbolTable.declareEnumEntryFromLinker((symbol as IrEnumEntrySymbol).descriptor, uniqId) {
IrEnumEntryImpl(startOffset, endOffset, origin, it, deserializeName(proto.name))
}.apply {
if (proto.hasCorrespondingClass())
@@ -1104,7 +1153,7 @@ abstract class IrFileDeserializer(
}
private fun deserializeIrAnonymousInit(proto: ProtoAnonymousInit) =
withDeserializedIrDeclarationBase(proto.base) { symbol, startOffset, endOffset, origin ->
withDeserializedIrDeclarationBase(proto.base) { symbol, _, startOffset, endOffset, origin, _ ->
IrAnonymousInitializerImpl(startOffset, endOffset, origin, symbol as IrAnonymousInitializerSymbol).apply {
// body = deserializeBlockBody(proto.body.blockBody, startOffset, endOffset)
body = deserializeStatementBody(proto.body) as IrBlockBody
@@ -1113,35 +1162,21 @@ abstract class IrFileDeserializer(
}
}
private fun deserializeVisibility(value: ProtoVisibility): Visibility { // TODO: switch to enum
return when (deserializeString(value.name)) {
"public" -> Visibilities.PUBLIC
"private" -> Visibilities.PRIVATE
"private_to_this" -> Visibilities.PRIVATE_TO_THIS
"protected" -> Visibilities.PROTECTED
"internal" -> Visibilities.INTERNAL
"invisible_fake" -> Visibilities.INVISIBLE_FAKE // TODO: eventually we should not serialize fake overrides, so this will be gone.
"local" -> Visibilities.LOCAL
else -> error("Unexpected visibility value: $value")
}
}
private fun deserializeIrConstructor(proto: ProtoConstructor) =
withDeserializedIrFunctionBase(proto.base) { symbol, startOffset, endOffset, origin ->
symbolTable.declareConstructor(
UNDEFINED_OFFSET, UNDEFINED_OFFSET, irrelevantOrigin,
(symbol as IrConstructorSymbol).descriptor
) {
withDeserializedIrFunctionBase(proto.base) { symbol, idSig, startOffset, endOffset, origin, fcode ->
val flags = FunctionFlags.decode(fcode)
val nameType = BinaryNameAndType.decode(proto.base.nameType)
symbolTable.declareConstructorFromLinker((symbol as IrConstructorSymbol).descriptor, idSig) {
IrConstructorImpl(
startOffset, endOffset, origin,
it,
deserializeName(proto.base.name),
deserializeVisibility(proto.base.visibility),
deserializeIrType(proto.base.returnType),
isInline = proto.base.isInline,
isExternal = proto.base.isExternal,
isPrimary = proto.isPrimary,
isExpect = proto.base.isExpect
deserializeName(nameType.nameIndex),
flags.visibility,
IrUninitializedType,
flags.isInline,
flags.isExternal,
flags.isPrimary,
flags.isExpect
)
}.apply {
(descriptor as? WrappedClassConstructorDescriptor)?.bind(this)
@@ -1149,24 +1184,21 @@ abstract class IrFileDeserializer(
}
private fun deserializeIrField(proto: ProtoField) =
withDeserializedIrDeclarationBase(proto.base) { symbol, startOffset, endOffset, origin ->
val type = deserializeIrType(proto.type)
symbolTable.declareField(
UNDEFINED_OFFSET, UNDEFINED_OFFSET, irrelevantOrigin,
(symbol as IrFieldSymbol).descriptor,
type
) {
withDeserializedIrDeclarationBase(proto.base) { symbol, uniqId, startOffset, endOffset, origin, fcode ->
val nameType = BinaryNameAndType.decode(proto.nameType)
val type = deserializeIrType(nameType.typeIndex)
val flags = FieldFlags.decode(fcode)
symbolTable.declareFieldFromLinker((symbol as IrFieldSymbol).descriptor, uniqId) {
IrFieldImpl(
startOffset, endOffset, origin,
it,
deserializeName(proto.name),
deserializeName(nameType.nameIndex),
type,
deserializeVisibility(proto.visibility),
isFinal = proto.isFinal,
isExternal = proto.isExternal,
isStatic = proto.isStatic,
isFakeOverride = proto.isFakeOverride
flags.visibility,
flags.isFinal,
flags.isExternal,
flags.isStatic,
flags.isFakeOverride
)
}.usingParent {
if (proto.hasInitializer())
@@ -1176,21 +1208,16 @@ abstract class IrFileDeserializer(
}
}
private fun deserializeModality(modality: ProtoModalityKind) = when (modality) {
ProtoModalityKind.OPEN_MODALITY -> Modality.OPEN
ProtoModalityKind.SEALED_MODALITY -> Modality.SEALED
ProtoModalityKind.FINAL_MODALITY -> Modality.FINAL
ProtoModalityKind.ABSTRACT_MODALITY -> Modality.ABSTRACT
}
private fun deserializeIrLocalDelegatedProperty(proto: ProtoLocalDelegatedProperty) =
withDeserializedIrDeclarationBase(proto.base) { symbol, startOffset, endOffset, origin ->
withDeserializedIrDeclarationBase(proto.base) { symbol, _, startOffset, endOffset, origin, fcode ->
val flags = LocalVariableFlags.decode(fcode)
val nameAndType = BinaryNameAndType.decode(proto.nameType)
IrLocalDelegatedPropertyImpl(
startOffset, endOffset, origin,
symbol as IrLocalDelegatedPropertySymbol,
deserializeName(proto.name),
deserializeIrType(proto.type),
proto.isVar
deserializeName(nameAndType.nameIndex),
deserializeIrType(nameAndType.typeIndex),
flags.isVar
).apply {
delegate = deserializeIrVariable(proto.delegate)
getter = deserializeIrFunction(proto.getter)
@@ -1202,24 +1229,22 @@ abstract class IrFileDeserializer(
}
private fun deserializeIrProperty(proto: ProtoProperty) =
withDeserializedIrDeclarationBase(proto.base) { symbol, startOffset, endOffset, origin ->
symbolTable.declareProperty(
UNDEFINED_OFFSET, UNDEFINED_OFFSET, irrelevantOrigin,
(symbol as IrPropertySymbol).descriptor, proto.isDelegated
) {
withDeserializedIrDeclarationBase(proto.base) { symbol, uniqId, startOffset, endOffset, origin, fcode ->
val flags = PropertyFlags.decode(fcode)
symbolTable.declarePropertyFromLinker((symbol as IrPropertySymbol).descriptor, uniqId) {
IrPropertyImpl(
startOffset, endOffset, origin,
it,
deserializeName(proto.name),
deserializeVisibility(proto.visibility),
deserializeModality(proto.modality),
isVar = proto.isVar,
isConst = proto.isConst,
isLateinit = proto.isLateinit,
isDelegated = proto.isDelegated,
isExpect = proto.isExpect,
isExternal = proto.isExternal,
isFakeOverride = proto.isFakeOverride
flags.visibility,
flags.modality,
flags.isVar,
flags.isConst,
flags.isLateinit,
flags.isDelegated,
flags.isExternal,
flags.isExpect,
flags.isFakeOverride
)
}.apply {
if (proto.hasGetter()) {
@@ -1255,8 +1280,8 @@ abstract class IrFileDeserializer(
allKnownDeclarationOrigins.map { it.objectInstance as IrDeclarationOriginImpl }.associateBy { it.name }
private fun deserializeIrDeclarationOrigin(proto: ProtoDeclarationOrigin): IrDeclarationOriginImpl {
val originName = deserializeString(proto.custom)
private fun deserializeIrDeclarationOrigin(protoName: Int): IrDeclarationOriginImpl {
val originName = deserializeString(protoName)
return declarationOriginIndex[originName] ?: object : IrDeclarationOriginImpl(originName) {}
}
@@ -1265,8 +1290,8 @@ abstract class IrFileDeserializer(
private val statementOriginIndex =
allKnownStatementOrigins.map { it.objectInstance as? IrStatementOriginImpl }.filterNotNull().associateBy { it.debugName }
fun deserializeIrStatementOrigin(proto: ProtoStatementOrigin): IrStatementOrigin {
return deserializeString(proto.name).let {
fun deserializeIrStatementOrigin(protoName: Int): IrStatementOrigin {
return deserializeString(protoName).let {
val componentPrefix = "COMPONENT_"
when {
it.startsWith(componentPrefix) -> {
@@ -1285,9 +1310,9 @@ abstract class IrFileDeserializer(
IR_CLASS -> deserializeIrClass(proto.irClass)
IR_FUNCTION -> deserializeIrFunction(proto.irFunction)
IR_PROPERTY -> deserializeIrProperty(proto.irProperty)
IR_TYPE_PARAMETER -> deserializeIrTypeParameter(proto.irTypeParameter)
IR_TYPE_PARAMETER -> error("Unreachable execution Type Parameter") // deserializeIrTypeParameter(proto.irTypeParameter)
IR_VARIABLE -> deserializeIrVariable(proto.irVariable)
IR_VALUE_PARAMETER -> deserializeIrValueParameter(proto.irValueParameter)
IR_VALUE_PARAMETER -> error("Unreachable execution Value Parameter") // deserializeIrValueParameter(proto.irValueParameter)
IR_ENUM_ENTRY -> deserializeIrEnumEntry(proto.irEnumEntry)
IR_LOCAL_DELEGATED_PROPERTY -> deserializeIrLocalDelegatedProperty(proto.irLocalDelegatedProperty)
IR_TYPE_ALIAS -> deserializeIrTypeAlias(proto.irTypeAlias)
@@ -7,33 +7,29 @@ package org.jetbrains.kotlin.backend.common.serialization
import org.jetbrains.kotlin.backend.common.LoggingContext
import org.jetbrains.kotlin.backend.common.ir.ir2string
import org.jetbrains.kotlin.backend.common.serialization.encodings.*
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.descriptors.ClassKind.*
import org.jetbrains.kotlin.ir.IrElement
import org.jetbrains.kotlin.ir.SourceManager
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.symbols.*
import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.util.findTopLevelDeclaration
import org.jetbrains.kotlin.ir.util.lineStartOffsets
import org.jetbrains.kotlin.ir.util.*
import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid
import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid
import org.jetbrains.kotlin.ir.visitors.acceptVoid
import org.jetbrains.kotlin.library.SerializedDeclaration
import org.jetbrains.kotlin.library.SerializedIrFile
import org.jetbrains.kotlin.library.SkippedDeclaration
import org.jetbrains.kotlin.library.TopLevelDeclaration
import org.jetbrains.kotlin.library.*
import org.jetbrains.kotlin.library.impl.IrMemoryArrayWriter
import org.jetbrains.kotlin.library.impl.IrMemoryDeclarationWriter
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.types.Variance
import org.jetbrains.kotlin.backend.common.serialization.proto.Actual as ProtoActual
import org.jetbrains.kotlin.backend.common.serialization.proto.ClassKind as ProtoClassKind
import org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates as ProtoCoordinates
import org.jetbrains.kotlin.backend.common.serialization.proto.FieldAccessCommon as ProtoFieldAccessCommon
import org.jetbrains.kotlin.backend.common.serialization.proto.FileEntry as ProtoFileEntry
import org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature as ProtoFileLocalIdSignature
import org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature as ProtoIdSignature
import org.jetbrains.kotlin.backend.common.serialization.proto.IrAnonymousInit as ProtoAnonymousInit
import org.jetbrains.kotlin.backend.common.serialization.proto.IrBlock as ProtoBlock
import org.jetbrains.kotlin.backend.common.serialization.proto.IrBlockBody as ProtoBlockBody
@@ -50,8 +46,6 @@ import org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall
import org.jetbrains.kotlin.backend.common.serialization.proto.IrContinue as ProtoContinue
import org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration as ProtoDeclaration
import org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationBase as ProtoDeclarationBase
import org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer as ProtoDeclarationContainer
import org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin as ProtoDeclarationOrigin
import org.jetbrains.kotlin.backend.common.serialization.proto.IrDelegatingConstructorCall as ProtoDelegatingConstructorCall
import org.jetbrains.kotlin.backend.common.serialization.proto.IrDoWhile as ProtoDoWhile
import org.jetbrains.kotlin.backend.common.serialization.proto.IrDynamicMemberExpression as ProtoDynamicMemberExpression
@@ -83,12 +77,8 @@ import org.jetbrains.kotlin.backend.common.serialization.proto.IrSetField as Pro
import org.jetbrains.kotlin.backend.common.serialization.proto.IrSetVariable as ProtoSetVariable
import org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType as ProtoSimpleType
import org.jetbrains.kotlin.backend.common.serialization.proto.IrSpreadElement as ProtoSpreadElement
import org.jetbrains.kotlin.backend.common.serialization.proto.IrStarProjection as ProtoStarProjection
import org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement as ProtoStatement
import org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin as ProtoStatementOrigin
import org.jetbrains.kotlin.backend.common.serialization.proto.IrStringConcat as ProtoStringConcat
import org.jetbrains.kotlin.backend.common.serialization.proto.IrSymbolData as ProtoSymbolData
import org.jetbrains.kotlin.backend.common.serialization.proto.IrSymbolKind as ProtoSymbolKind
import org.jetbrains.kotlin.backend.common.serialization.proto.IrSyntheticBody as ProtoSyntheticBody
import org.jetbrains.kotlin.backend.common.serialization.proto.IrSyntheticBodyKind as ProtoSyntheticBodyKind
import org.jetbrains.kotlin.backend.common.serialization.proto.IrThrow as ProtoThrow
@@ -96,13 +86,9 @@ import org.jetbrains.kotlin.backend.common.serialization.proto.IrTry as ProtoTry
import org.jetbrains.kotlin.backend.common.serialization.proto.IrType as ProtoType
import org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAbbreviation as ProtoTypeAbbreviation
import org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAlias as ProtoTypeAlias
import org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeArgument as ProtoTypeArgument
import org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeOp as ProtoTypeOp
import org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeOperator as ProtoTypeOperator
import org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter as ProtoTypeParameter
import org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameterContainer as ProtoTypeParameterContainer
import org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeProjection as ProtoTypeProjection
import org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeVariance as ProtoTypeVariance
import org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter as ProtoValueParameter
import org.jetbrains.kotlin.backend.common.serialization.proto.IrVararg as ProtoVararg
import org.jetbrains.kotlin.backend.common.serialization.proto.IrVarargElement as ProtoVarargElement
@@ -111,10 +97,9 @@ import org.jetbrains.kotlin.backend.common.serialization.proto.IrWhen as ProtoWh
import org.jetbrains.kotlin.backend.common.serialization.proto.IrWhile as ProtoWhile
import org.jetbrains.kotlin.backend.common.serialization.proto.Loop as ProtoLoop
import org.jetbrains.kotlin.backend.common.serialization.proto.MemberAccessCommon as ProtoMemberAccessCommon
import org.jetbrains.kotlin.backend.common.serialization.proto.ModalityKind as ProtoModalityKind
import org.jetbrains.kotlin.backend.common.serialization.proto.NullableIrExpression as ProtoNullableIrExpression
import org.jetbrains.kotlin.backend.common.serialization.proto.TypeArguments as ProtoTypeArguments
import org.jetbrains.kotlin.backend.common.serialization.proto.Visibility as ProtoVisibility
import org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature as ProtoPublicIdSignature
import org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature as ProtoAccessorIdSignature
open class IrFileSerializer(
val logger: LoggingContext,
@@ -130,11 +115,6 @@ open class IrFileSerializer(
// The linker substitutes actual symbols when asked for an expect uniqId.
private val expectActualTable = ExpectActualTable(expectDescriptorToSymbol)
// The same symbol can be used multiple times in a file
// so use this index to store symbol data only once.
private val protoSymbolMap = mutableMapOf<IrSymbol, Int>()
private val protoSymbolArray = arrayListOf<ProtoSymbolData>()
// The same type can be used multiple times in a file
// so use this index to store type data only once.
private val protoTypeMap = mutableMapOf<IrTypeKey, Int>()
@@ -143,10 +123,12 @@ open class IrFileSerializer(
private val protoStringMap = mutableMapOf<String, Int>()
private val protoStringArray = arrayListOf<String>()
private val protoBodyArray = mutableListOf<XStatementOrExpression>()
// The same signature could be used multiple times in a file
// so use this index to store signature only once.
private val protoIdSignatureMap = mutableMapOf<IdSignature, Int>()
private val protoIdSignatureArray = arrayListOf<ProtoIdSignature>()
private val descriptorReferenceSerializer =
DescriptorReferenceSerializer(declarationTable, { serializeString(it) }, { serializeFqName(it) }, skipExpects)
private val protoBodyArray = mutableListOf<XStatementOrExpression>()
sealed class XStatementOrExpression {
abstract fun toByteArray(): ByteArray
@@ -182,27 +164,11 @@ open class IrFileSerializer(
/* ------- Common fields ---------------------------------------------------- */
private fun serializeIrDeclarationOrigin(origin: IrDeclarationOrigin) =
ProtoDeclarationOrigin.newBuilder()
.setCustom(serializeString((origin as IrDeclarationOriginImpl).name))
.build()
private fun serializeIrDeclarationOrigin(origin: IrDeclarationOrigin): Int = serializeString((origin as IrDeclarationOriginImpl).name)
private fun serializeIrStatementOrigin(origin: IrStatementOrigin) =
ProtoStatementOrigin.newBuilder()
.setName(serializeString((origin as IrStatementOriginImpl).debugName))
.build()
private fun serializeIrStatementOrigin(origin: IrStatementOrigin): Int = serializeString((origin as IrStatementOriginImpl).debugName)
private fun serializeVisibility(visibility: Visibility) =
ProtoVisibility.newBuilder()
.setName(serializeString(visibility.name))
.build()
private fun serializeCoordinates(start: Int, end: Int): ProtoCoordinates {
return ProtoCoordinates.newBuilder()
.setStartOffset(start)
.setEndOffset(end)
.build()
}
private fun serializeCoordinates(start: Int, end: Int): Long = BinaryCoordinates.encode(start, end)
/* ------- Strings ---------------------------------------------------------- */
@@ -213,113 +179,137 @@ open class IrFileSerializer(
private fun serializeName(name: Name): Int = serializeString(name.toString())
/* ------- IdSignature ------------------------------------------------------ */
private fun serializePublicSignature(signature: IdSignature.PublicSignature): ProtoPublicIdSignature {
val proto = ProtoPublicIdSignature.newBuilder()
proto.addAllPackageFqName(serializeFqName(signature.packageFqn))
proto.addAllClassFqName(serializeFqName(signature.classFqn))
signature.id?.let { proto.memberUniqId = it }
if (signature.mask != 0L) {
proto.flags = signature.mask
}
return proto.build()
}
private fun serializeAccessorSignature(signature: IdSignature.AccessorSignature): ProtoAccessorIdSignature {
val proto = ProtoAccessorIdSignature.newBuilder()
proto.propertySignature = protoIdSignature(signature.propertySignature)
with(signature.accessorSignature) {
proto.name = serializeString(classFqn.shortName().asString())
proto.accessorHashId = id ?: error("Expected hash Id")
if (mask != 0L) {
proto.flags = mask
}
}
return proto.build()
}
private fun serializePrivateSignature(signature: IdSignature.FileLocalSignature): ProtoFileLocalIdSignature {
val proto = ProtoFileLocalIdSignature.newBuilder()
proto.container = protoIdSignature(signature.container)
proto.localId = signature.id
return proto.build()
}
private fun serializeScopeLocalSignature(signature: IdSignature.ScopeLocalDeclaration): Int = signature.id
private fun serializeIdSignature(idSignature: IdSignature): ProtoIdSignature {
val proto = ProtoIdSignature.newBuilder()
when (idSignature) {
is IdSignature.PublicSignature -> proto.publicSig = serializePublicSignature(idSignature)
is IdSignature.AccessorSignature -> proto.accessorSig = serializeAccessorSignature(idSignature)
is IdSignature.FileLocalSignature -> proto.privateSig = serializePrivateSignature(idSignature)
is IdSignature.ScopeLocalDeclaration -> proto.scopedLocalSig = serializeScopeLocalSignature(idSignature)
}
return proto.build()
}
private fun protoIdSignature(declaration: IrDeclaration): Int {
val idSig = declarationTable.signatureByDeclaration(declaration)
return protoIdSignature(idSig)
}
private fun protoIdSignature(idSig: IdSignature): Int {
return protoIdSignatureMap.getOrPut(idSig) {
protoIdSignatureArray.add(serializeIdSignature(idSig))
protoIdSignatureArray.size - 1
}
}
/* ------- IrSymbols -------------------------------------------------------- */
private fun protoSymbolKind(symbol: IrSymbol): ProtoSymbolKind = when (symbol) {
private fun protoSymbolKind(symbol: IrSymbol): BinarySymbolData.SymbolKind = when (symbol) {
is IrAnonymousInitializerSymbol ->
ProtoSymbolKind.ANONYMOUS_INIT_SYMBOL
BinarySymbolData.SymbolKind.ANONYMOUS_INIT_SYMBOL
is IrClassSymbol ->
ProtoSymbolKind.CLASS_SYMBOL
BinarySymbolData.SymbolKind.CLASS_SYMBOL
is IrConstructorSymbol ->
ProtoSymbolKind.CONSTRUCTOR_SYMBOL
BinarySymbolData.SymbolKind.CONSTRUCTOR_SYMBOL
is IrTypeParameterSymbol ->
ProtoSymbolKind.TYPE_PARAMETER_SYMBOL
BinarySymbolData.SymbolKind.TYPE_PARAMETER_SYMBOL
is IrEnumEntrySymbol ->
ProtoSymbolKind.ENUM_ENTRY_SYMBOL
BinarySymbolData.SymbolKind.ENUM_ENTRY_SYMBOL
is IrVariableSymbol ->
ProtoSymbolKind.VARIABLE_SYMBOL
BinarySymbolData.SymbolKind.VARIABLE_SYMBOL
is IrValueParameterSymbol ->
if (symbol.descriptor is ReceiverParameterDescriptor) // TODO: we use descriptor here.
ProtoSymbolKind.RECEIVER_PARAMETER_SYMBOL
BinarySymbolData.SymbolKind.RECEIVER_PARAMETER_SYMBOL
else
ProtoSymbolKind.VALUE_PARAMETER_SYMBOL
BinarySymbolData.SymbolKind.VALUE_PARAMETER_SYMBOL
is IrSimpleFunctionSymbol ->
ProtoSymbolKind.FUNCTION_SYMBOL
BinarySymbolData.SymbolKind.FUNCTION_SYMBOL
is IrReturnableBlockSymbol ->
ProtoSymbolKind.RETURNABLE_BLOCK_SYMBOL
BinarySymbolData.SymbolKind.RETURNABLE_BLOCK_SYMBOL
is IrFieldSymbol ->
if (symbol.owner.correspondingPropertySymbol?.owner.let { it == null || it.isDelegated })
ProtoSymbolKind.STANDALONE_FIELD_SYMBOL
BinarySymbolData.SymbolKind.STANDALONE_FIELD_SYMBOL
else
ProtoSymbolKind.FIELD_SYMBOL
BinarySymbolData.SymbolKind.FIELD_SYMBOL
is IrPropertySymbol ->
ProtoSymbolKind.PROPERTY_SYMBOL
BinarySymbolData.SymbolKind.PROPERTY_SYMBOL
is IrLocalDelegatedPropertySymbol ->
ProtoSymbolKind.LOCAL_DELEGATED_PROPERTY_SYMBOL
BinarySymbolData.SymbolKind.LOCAL_DELEGATED_PROPERTY_SYMBOL
is IrTypeAliasSymbol ->
ProtoSymbolKind.TYPEALIAS_SYMBOL
BinarySymbolData.SymbolKind.TYPEALIAS_SYMBOL
else ->
TODO("Unexpected symbol kind: $symbol")
}
private fun serializeIrSymbolData(symbol: IrSymbol): ProtoSymbolData {
fun serializeIrSymbol(symbol: IrSymbol): Long {
val declaration = symbol.owner as? IrDeclaration ?: error("Expected IrDeclaration: ${symbol.owner.render()}")
val declaration = symbol.owner as? IrDeclaration ?: error("Expected IrDeclaration: ${symbol.owner}")
val proto = ProtoSymbolData.newBuilder()
proto.kind = protoSymbolKind(symbol)
val uniqId =
declarationTable.uniqIdByDeclaration(declaration)
proto.uniqIdIndex = uniqId.index
val topLevelUniqId =
declarationTable.uniqIdByDeclaration((declaration).findTopLevelDeclaration())
proto.topLevelUniqIdIndex = topLevelUniqId.index
descriptorReferenceSerializer.serializeDescriptorReference(declaration)?.let {
proto.setDescriptorReference(it)
}
return proto.build()
}
fun serializeIrSymbol(symbol: IrSymbol) = protoSymbolMap.getOrPut(symbol) {
val symbolData = serializeIrSymbolData(symbol)
protoSymbolArray.add(symbolData)
protoSymbolArray.size - 1
val symbolKind = protoSymbolKind(symbol)
val signatureId = protoIdSignature(declaration)
return BinarySymbolData
.encode(symbolKind, signatureId)
}
/* ------- IrTypes ---------------------------------------------------------- */
// TODO: we, probably, need a type table.
private fun serializeTypeArguments(call: IrMemberAccessExpression): ProtoTypeArguments {
val proto = ProtoTypeArguments.newBuilder()
for (i in 0 until call.typeArgumentsCount) {
proto.addTypeArgument(serializeIrType(call.getTypeArgument(i)!!))
}
return proto.build()
}
private fun serializeIrTypeVariance(variance: Variance) = when (variance) {
Variance.IN_VARIANCE -> ProtoTypeVariance.IN
Variance.OUT_VARIANCE -> ProtoTypeVariance.OUT
Variance.INVARIANT -> ProtoTypeVariance.INV
}
private fun serializeAnnotations(annotations: List<IrConstructorCall>) =
annotations.map { serializeConstructorCall(it) }
private fun serializeFqName(fqName: FqName) = fqName.pathSegments().map { serializeString(it.identifier) }
private fun serializeFqName(fqName: FqName) = fqName.pathSegments().map { serializeString(it.asString()) }
private fun serializeIrTypeProjection(argument: IrTypeProjection): ProtoTypeProjection = ProtoTypeProjection.newBuilder()
.setVariance(serializeIrTypeVariance(argument.variance))
.setType(serializeIrType(argument.type))
.build()
private fun serializeIrStarProjection() = BinaryTypeProjection.STAR_CODE
private fun serializeTypeArgument(argument: IrTypeArgument): ProtoTypeArgument {
val proto = ProtoTypeArgument.newBuilder()
when (argument) {
is IrStarProjection ->
proto.star = ProtoStarProjection.newBuilder()
.build() // TODO: Do we need a singletone here? Or just an enum?
is IrTypeProjection ->
proto.type = serializeIrTypeProjection(argument)
private fun serializeIrTypeProjection(argument: IrTypeProjection) =
BinaryTypeProjection
.encodeType(argument.variance, serializeIrType(argument.type))
private fun serializeTypeArgument(argument: IrTypeArgument): Long {
return when (argument) {
is IrStarProjection -> serializeIrStarProjection()
is IrTypeProjection -> serializeIrTypeProjection(argument)
else -> TODO("Unexpected type argument kind: $argument")
}
return proto.build()
}
private fun serializeSimpleType(type: IrSimpleType): ProtoSimpleType {
@@ -448,7 +438,7 @@ open class IrFileSerializer(
private fun serializeBlock(block: IrBlock): ProtoBlock {
val proto = ProtoBlock.newBuilder()
block.origin?.let { proto.setOrigin(serializeIrStatementOrigin(it)) }
block.origin?.let { proto.setOriginName(serializeIrStatementOrigin(it)) }
block.statements.forEach {
proto.addStatement(serializeStatement(it))
@@ -459,7 +449,7 @@ open class IrFileSerializer(
private fun serializeComposite(composite: IrComposite): ProtoComposite {
val proto = ProtoComposite.newBuilder()
composite.origin?.let { proto.setOrigin(serializeIrStatementOrigin(it)) }
composite.origin?.let { proto.setOriginName(serializeIrStatementOrigin(it)) }
composite.statements.forEach {
proto.addStatement(serializeStatement(it))
}
@@ -490,7 +480,11 @@ open class IrFileSerializer(
if (call.dispatchReceiver != null) {
proto.dispatchReceiver = serializeExpression(call.dispatchReceiver!!)
}
proto.typeArguments = serializeTypeArguments(call)
for (index in 0 until call.typeArgumentsCount) {
val typeArgument = call.getTypeArgument(index) ?: error("Expected type argument at $index in ${call.render()}")
proto.addTypeArgument(serializeIrType(typeArgument))
}
for (index in 0 until call.valueArgumentsCount) {
val actual = call.getValueArgument(index)
@@ -513,7 +507,7 @@ open class IrFileSerializer(
private fun serializeCall(call: IrCall): ProtoCall {
val proto = ProtoCall.newBuilder()
proto.symbol = serializeIrSymbol(call.symbol)
call.origin?.let { proto.origin = serializeIrStatementOrigin(it) }
call.origin?.let { proto.originName = serializeIrStatementOrigin(it) }
call.superQualifierSymbol?.let {
proto.`super` = serializeIrSymbol(it)
@@ -533,23 +527,16 @@ open class IrFileSerializer(
private fun serializeFunctionExpression(functionExpression: IrFunctionExpression): ProtoFunctionExpression =
ProtoFunctionExpression.newBuilder().apply {
function = serializeIrFunction(functionExpression.function)
origin = serializeIrStatementOrigin(functionExpression.origin)
originName = serializeIrStatementOrigin(functionExpression.origin)
}.build()
private fun serializeFunctionReference(callable: IrFunctionReference): ProtoFunctionReference {
val proto = ProtoFunctionReference.newBuilder()
.setSymbol(serializeIrSymbol(callable.symbol))
.setMemberAccess(serializeMemberAccessCommon(callable))
.apply {
val reflectionTarget = callable.reflectionTarget
if (reflectionTarget != null) {
setReflectionTarget(serializeIrSymbol(reflectionTarget))
} else {
clearReflectionTarget()
}
}
callable.origin?.let { proto.setOrigin(serializeIrStatementOrigin(it)) }
callable.reflectionTarget?.let { proto.reflectionTargetSymbol = serializeIrSymbol(it) }
callable.origin?.let { proto.originName = serializeIrStatementOrigin(it) }
return proto.build()
}
@@ -561,7 +548,7 @@ open class IrFileSerializer(
.setGetter(serializeIrSymbol(callable.getter))
.setSymbol(serializeIrSymbol(callable.symbol))
callable.origin?.let { proto.setOrigin(serializeIrStatementOrigin(it)) }
callable.origin?.let { proto.setOriginName(serializeIrStatementOrigin(it)) }
callable.setter?.let { proto.setSetter(serializeIrSymbol(it)) }
return proto.build()
@@ -571,7 +558,8 @@ open class IrFileSerializer(
val proto = ProtoPropertyReference.newBuilder()
.setMemberAccess(serializeMemberAccessCommon(callable))
.setSymbol(serializeIrSymbol(callable.symbol))
callable.origin?.let { proto.origin = serializeIrStatementOrigin(it) }
callable.origin?.let { proto.originName = serializeIrStatementOrigin(it) }
callable.field?.let { proto.field = serializeIrSymbol(it) }
callable.getter?.let { proto.getter = serializeIrSymbol(it) }
callable.setter?.let { proto.setter = serializeIrSymbol(it) }
@@ -645,14 +633,14 @@ open class IrFileSerializer(
private fun serializeGetField(expression: IrGetField): ProtoGetField =
ProtoGetField.newBuilder()
.setFieldAccess(serializeFieldAccessCommon(expression)).apply {
expression.origin?.let { origin = serializeIrStatementOrigin(it) }
expression.origin?.let { originName = serializeIrStatementOrigin(it) }
}
.build()
private fun serializeGetValue(expression: IrGetValue): ProtoGetValue =
ProtoGetValue.newBuilder()
.setSymbol(serializeIrSymbol(expression.symbol)).apply {
expression.origin?.let { origin = serializeIrStatementOrigin(it) }
expression.origin?.let { originName = serializeIrStatementOrigin(it) }
}
.build()
@@ -681,7 +669,7 @@ open class IrFileSerializer(
ProtoSetField.newBuilder()
.setFieldAccess(serializeFieldAccessCommon(expression))
.setValue(serializeExpression(expression.value)).apply {
expression.origin?.let { origin = serializeIrStatementOrigin(it) }
expression.origin?.let { originName = serializeIrStatementOrigin(it) }
}
.build()
@@ -689,7 +677,7 @@ open class IrFileSerializer(
ProtoSetVariable.newBuilder()
.setSymbol(serializeIrSymbol(expression.symbol))
.setValue(serializeExpression(expression.value)).apply {
expression.origin?.let { origin = serializeIrStatementOrigin(it) }
expression.origin?.let { originName = serializeIrStatementOrigin(it) }
}
.build()
@@ -788,7 +776,7 @@ open class IrFileSerializer(
private fun serializeWhen(expression: IrWhen): ProtoWhen {
val proto = ProtoWhen.newBuilder()
expression.origin?.let { proto.setOrigin(serializeIrStatementOrigin(it)) }
expression.origin?.let { proto.setOriginName(serializeIrStatementOrigin(it)) }
val branches = expression.branches
branches.forEach {
@@ -801,7 +789,7 @@ open class IrFileSerializer(
private fun serializeLoop(expression: IrLoop): ProtoLoop {
val proto = ProtoLoop.newBuilder()
.setCondition(serializeExpression(expression.condition)).apply {
expression.origin?.let { setOrigin(serializeIrStatementOrigin(it)) }
expression.origin?.let { setOriginName(serializeIrStatementOrigin(it)) }
}
expression.label?.let {
@@ -997,24 +985,28 @@ open class IrFileSerializer(
return proto.build()
}
private fun serializeIrDeclarationBase(declaration: IrDeclaration): ProtoDeclarationBase {
if (!skipExpects) expectActualTable.findExpectsForActuals(declaration)
return ProtoDeclarationBase.newBuilder()
.setSymbol(serializeIrSymbol((declaration as IrSymbolOwner).symbol))
.setCoordinates(serializeCoordinates(declaration.startOffset, declaration.endOffset))
.addAllAnnotation(serializeAnnotations(declaration.annotations))
.setOrigin(serializeIrDeclarationOrigin(declaration.origin))
.build()
private fun serializeIrDeclarationBase(declaration: IrDeclaration, flags: Long?): ProtoDeclarationBase {
expectActualTable.findExpectsForActuals(declaration)
return with(ProtoDeclarationBase.newBuilder()) {
symbol = serializeIrSymbol((declaration as IrSymbolOwner).symbol)
coordinates = serializeCoordinates(declaration.startOffset, declaration.endOffset)
addAllAnnotation(serializeAnnotations(declaration.annotations))
flags?.let { setFlags(it) }
originName = serializeIrDeclarationOrigin(declaration.origin)
build()
}
}
private fun serializeNameAndType(name: Name, type: IrType): Long {
val nameIndex = serializeName(name)
val typeIndex = serializeIrType(type)
return BinaryNameAndType.encode(nameIndex, typeIndex)
}
private fun serializeIrValueParameter(parameter: IrValueParameter): ProtoValueParameter {
val proto = ProtoValueParameter.newBuilder()
.setBase(serializeIrDeclarationBase(parameter))
.setName(serializeName(parameter.name))
.setIndex(parameter.index)
.setType(serializeIrType(parameter.type))
.setIsCrossinline(parameter.isCrossinline)
.setIsNoinline(parameter.isNoinline)
.setBase(serializeIrDeclarationBase(parameter, ValueParameterFlags.encode(parameter)))
.setNameType(serializeNameAndType(parameter.name, parameter.type))
parameter.varargElementType?.let { proto.setVarargElementType(serializeIrType(it)) }
parameter.defaultValue?.let { proto.setDefaultValue(serializeIrExpressionBody(it.expression)) }
@@ -1024,35 +1016,22 @@ open class IrFileSerializer(
private fun serializeIrTypeParameter(parameter: IrTypeParameter): ProtoTypeParameter {
val proto = ProtoTypeParameter.newBuilder()
.setBase(serializeIrDeclarationBase(parameter))
.setBase(serializeIrDeclarationBase(parameter, TypeParameterFlags.encode(parameter)))
.setName(serializeName(parameter.name))
.setIndex(parameter.index)
.setVariance(serializeIrTypeVariance(parameter.variance))
.setIsReified(parameter.isReified)
parameter.superTypes.forEach {
proto.addSuperType(serializeIrType(it))
}
return proto.build()
}
private fun serializeIrTypeParameterContainer(typeParameters: List<IrTypeParameter>): ProtoTypeParameterContainer {
val proto = ProtoTypeParameterContainer.newBuilder()
typeParameters.forEach {
private fun serializeIrFunctionBase(function: IrFunction, flags: Long): ProtoFunctionBase {
val proto = ProtoFunctionBase.newBuilder()
.setBase(serializeIrDeclarationBase(function, flags))
.setNameType(serializeNameAndType(function.name, function.returnType))
function.typeParameters.forEach {
proto.addTypeParameter(serializeIrTypeParameter(it))
}
return proto.build()
}
private fun serializeIrFunctionBase(function: IrFunction): ProtoFunctionBase {
val proto = ProtoFunctionBase.newBuilder()
.setBase(serializeIrDeclarationBase(function))
.setName(serializeName(function.name))
.setVisibility(serializeVisibility(function.visibility))
.setIsInline(function.isInline)
.setIsExternal(function.isExternal)
.setIsExpect(function.isExpect)
.setReturnType(serializeIrType(function.returnType))
.setTypeParameters(serializeIrTypeParameterContainer(function.typeParameters))
function.dispatchReceiverParameter?.let { proto.setDispatchReceiver(serializeIrValueParameter(it)) }
function.extensionReceiverParameter?.let { proto.setExtensionReceiver(serializeIrValueParameter(it)) }
@@ -1065,27 +1044,14 @@ open class IrFileSerializer(
return proto.build()
}
private fun serializeModality(modality: Modality) = when (modality) {
Modality.FINAL -> ProtoModalityKind.FINAL_MODALITY
Modality.SEALED -> ProtoModalityKind.SEALED_MODALITY
Modality.OPEN -> ProtoModalityKind.OPEN_MODALITY
Modality.ABSTRACT -> ProtoModalityKind.ABSTRACT_MODALITY
}
private fun serializeIrConstructor(declaration: IrConstructor): ProtoConstructor =
ProtoConstructor.newBuilder()
.setBase(serializeIrFunctionBase(declaration))
.setIsPrimary(declaration.isPrimary)
.setBase(serializeIrFunctionBase(declaration, FunctionFlags.encode(declaration)))
.build()
private fun serializeIrFunction(declaration: IrSimpleFunction): ProtoFunction {
val proto = ProtoFunction.newBuilder()
.setBase(serializeIrFunctionBase(declaration))
.setModality(serializeModality(declaration.modality))
.setIsTailrec(declaration.isTailrec)
.setIsSuspend(declaration.isSuspend)
.setIsFakeOverride(declaration.isFakeOverride)
.setIsOperator(declaration.isOperator)
.setBase(serializeIrFunctionBase(declaration, FunctionFlags.encode(declaration)))
declaration.overriddenSymbols.forEach {
proto.addOverridden(serializeIrSymbol(it))
@@ -1096,16 +1062,14 @@ open class IrFileSerializer(
private fun serializeIrAnonymousInit(declaration: IrAnonymousInitializer) =
ProtoAnonymousInit.newBuilder()
.setBase(serializeIrDeclarationBase(declaration))
.setBase(serializeIrDeclarationBase(declaration, null))
.setBody(serializeIrStatementBody(declaration.body))
.build()
private fun serializeIrLocalDelegatedProperty(variable: IrLocalDelegatedProperty): ProtoLocalDelegatedProperty {
val proto = ProtoLocalDelegatedProperty.newBuilder()
.setBase(serializeIrDeclarationBase(variable))
.setName(serializeString(variable.name.toString()))
.setIsVar(variable.isVar)
.setType(serializeIrType(variable.type))
.setBase(serializeIrDeclarationBase(variable, LocalVariableFlags.encode(variable)))
.setNameType(serializeNameAndType(variable.name, variable.type))
.setDelegate(serializeIrVariable(variable.delegate))
.setGetter(serializeIrFunction(variable.getter as IrSimpleFunction)) // TODO: can it be non simple?
@@ -1115,21 +1079,9 @@ open class IrFileSerializer(
}
private fun serializeIrProperty(property: IrProperty): ProtoProperty {
declarationTable.uniqIdByDeclaration(property)
val proto = ProtoProperty.newBuilder()
.setBase(serializeIrDeclarationBase(property))
.setIsDelegated(property.isDelegated)
.setBase(serializeIrDeclarationBase(property, PropertyFlags.encode(property)))
.setName(serializeName(property.name))
.setVisibility(serializeVisibility(property.visibility))
.setModality(serializeModality(property.modality))
.setIsVar(property.isVar)
.setIsConst(property.isConst)
.setIsLateinit(property.isLateinit)
.setIsDelegated(property.isDelegated)
.setIsExternal(property.isExternal)
.setIsExpect(property.isExpect)
.setIsFakeOverride(property.isFakeOverride)
val backingField = property.backingField
val getter = property.getter
@@ -1146,14 +1098,8 @@ open class IrFileSerializer(
private fun serializeIrField(field: IrField): ProtoField {
val proto = ProtoField.newBuilder()
.setBase(serializeIrDeclarationBase(field))
.setName(serializeName(field.name))
.setVisibility(serializeVisibility(field.visibility))
.setIsFinal(field.isFinal)
.setIsExternal(field.isExternal)
.setIsStatic(field.isStatic)
.setType(serializeIrType(field.type))
.setIsFakeOverride(field.isFakeOverride)
.setBase(serializeIrDeclarationBase(field, FieldFlags.encode(field)))
.setNameType(serializeNameAndType(field.name, field.type))
val initializer = field.initializer?.expression
if (initializer != null) {
proto.initializer = serializeIrExpressionBody(initializer)
@@ -1163,71 +1109,50 @@ open class IrFileSerializer(
private fun serializeIrVariable(variable: IrVariable): ProtoVariable {
val proto = ProtoVariable.newBuilder()
.setBase(serializeIrDeclarationBase(variable))
.setName(serializeName(variable.name))
.setType(serializeIrType(variable.type))
.setIsConst(variable.isConst)
.setIsVar(variable.isVar)
.setIsLateinit(variable.isLateinit)
.setBase(serializeIrDeclarationBase(variable, LocalVariableFlags.encode(variable)))
.setNameType(serializeNameAndType(variable.name, variable.type))
variable.initializer?.let { proto.initializer = serializeExpression(it) }
return proto.build()
}
private fun serializeIrDeclarationContainer(declarations: List<IrDeclaration>): ProtoDeclarationContainer {
val proto = ProtoDeclarationContainer.newBuilder()
declarations.forEach {
//if (it is IrDeclarationWithVisibility && it.visibility == Visibilities.INVISIBLE_FAKE) return@forEach
proto.addDeclaration(serializeDeclaration(it))
}
return proto.build()
}
private fun serializeClassKind(kind: ClassKind) = when (kind) {
CLASS -> ProtoClassKind.CLASS
INTERFACE -> ProtoClassKind.INTERFACE
ENUM_CLASS -> ProtoClassKind.ENUM_CLASS
ENUM_ENTRY -> ProtoClassKind.ENUM_ENTRY
ANNOTATION_CLASS -> ProtoClassKind.ANNOTATION_CLASS
OBJECT -> ProtoClassKind.OBJECT
}
private fun serializeIrClass(clazz: IrClass): ProtoClass {
val proto = ProtoClass.newBuilder()
.setBase(serializeIrDeclarationBase(clazz))
.setBase(serializeIrDeclarationBase(clazz, ClassFlags.encode(clazz)))
.setName(serializeName(clazz.name))
.setKind(serializeClassKind(clazz.kind))
.setVisibility(serializeVisibility(clazz.visibility))
.setModality(serializeModality(clazz.modality))
.setIsCompanion(clazz.isCompanion)
.setIsInner(clazz.isInner)
.setIsData(clazz.isData)
.setIsExternal(clazz.isExternal)
.setIsInline(clazz.isInline)
.setIsExpect(clazz.isExpect)
.setIsFun(clazz.isFun)
.setTypeParameters(serializeIrTypeParameterContainer(clazz.typeParameters))
.setDeclarationContainer(serializeIrDeclarationContainer(clazz.declarations))
clazz.declarations.forEach {
proto.addDeclaration(serializeDeclaration(it))
}
clazz.typeParameters.forEach {
proto.addTypeParameter(serializeIrTypeParameter(it))
}
clazz.superTypes.forEach {
proto.addSuperType(serializeIrType(it))
}
clazz.thisReceiver?.let { proto.thisReceiver = serializeIrValueParameter(it) }
return proto.build()
}
private fun serializeIrTypeAlias(typeAlias: IrTypeAlias): ProtoTypeAlias =
ProtoTypeAlias.newBuilder()
.setBase(serializeIrDeclarationBase(typeAlias))
.setName(serializeName(typeAlias.name))
.setVisibility(serializeVisibility(typeAlias.visibility))
.setTypeParameters(serializeIrTypeParameterContainer(typeAlias.typeParameters))
.setExpandedType(serializeIrType(typeAlias.expandedType))
.setIsActual(typeAlias.isActual)
.build()
private fun serializeIrTypeAlias(typeAlias: IrTypeAlias): ProtoTypeAlias {
val proto = ProtoTypeAlias.newBuilder()
proto.setBase(serializeIrDeclarationBase(typeAlias, TypeAliasFlags.encode(typeAlias)))
.setNameType(serializeNameAndType(typeAlias.name, typeAlias.expandedType))
typeAlias.typeParameters.forEach {
proto.addTypeParameter(serializeIrTypeParameter(it))
}
return proto.build()
}
private fun serializeIrEnumEntry(enumEntry: IrEnumEntry): ProtoEnumEntry {
val proto = ProtoEnumEntry.newBuilder()
.setBase(serializeIrDeclarationBase(enumEntry))
.setBase(serializeIrDeclarationBase(enumEntry, null))
.setName(serializeName(enumEntry.name))
enumEntry.initializerExpression?.let {
@@ -1302,11 +1227,14 @@ open class IrFileSerializer(
}
val byteArray = serializeDeclaration(it).toByteArray()
val uniqId = declarationTable.uniqIdByDeclaration(it)
topLevelDeclarations.add(TopLevelDeclaration(uniqId.index, uniqId.isLocal, it.descriptor.toString(), byteArray))
if (uniqId.isPublic) {
proto.addDeclarationId(uniqId.index)
}
val idSig = declarationTable.signatureByDeclaration(it)
require(idSig === idSig.topLevelSignature()) { "IdSig: $idSig\ntopLevel: ${idSig.topLevelSignature()}" }
require(!idSig.isPackageSignature()) { "IsSig: $idSig\nDeclaration: ${it.render()}" }
// TODO: keep order similar
val sigIndex = protoIdSignatureMap[idSig] ?: error("Not found ID for $idSig (${it.render()})")
topLevelDeclarations.add(TopLevelDeclaration(sigIndex, it.descriptor.toString(), byteArray))
proto.addDeclarationId(sigIndex)
}
// TODO: is it Konan specific?
@@ -1315,29 +1243,34 @@ open class IrFileSerializer(
file.declarations
.filterIsInstance<IrProperty>()
.filter { it.backingField?.initializer != null && keepOrderOfProperties(it) }
.forEach { proto.addExplicitlyExportedToCompiler(serializeIrSymbol(it.backingField!!.symbol)) }
.forEach {
val fieldSymbol = it.backingField?.symbol ?: error("Not found ID ${it.render()}")
proto.addExplicitlyExportedToCompiler(serializeIrSymbol(fieldSymbol))
}
// TODO: Konan specific
file.acceptVoid(object : IrElementVisitorVoid {
override fun visitElement(element: IrElement) {
element.acceptChildrenVoid(this)
}
override fun visitFunction(declaration: IrFunction) {
if (backendSpecificExplicitRoot(declaration)) {
proto.addExplicitlyExportedToCompiler(serializeIrSymbol(declaration.symbol))
file.acceptVoid(
object : IrElementVisitorVoid {
override fun visitElement(element: IrElement) {
element.acceptChildrenVoid(this)
}
super.visitDeclaration(declaration)
}
override fun visitClass(declaration: IrClass) {
if (backendSpecificExplicitRoot(declaration)) {
proto.addExplicitlyExportedToCompiler(serializeIrSymbol(declaration.symbol))
override fun visitFunction(declaration: IrFunction) {
if (backendSpecificExplicitRoot(declaration)) {
proto.addExplicitlyExportedToCompiler(serializeIrSymbol(declaration.symbol))
}
super.visitDeclaration(declaration)
}
override fun visitClass(declaration: IrClass) {
if (backendSpecificExplicitRoot(declaration)) {
proto.addExplicitlyExportedToCompiler(serializeIrSymbol(declaration.symbol))
}
super.visitDeclaration(declaration)
}
super.visitDeclaration(declaration)
}
})
)
serializeExpectActualSubstitutionTable(proto)
@@ -1345,8 +1278,8 @@ open class IrFileSerializer(
proto.build().toByteArray(),
file.fqName.asString(),
file.path,
IrMemoryArrayWriter(protoSymbolArray.map { it.toByteArray() }).writeIntoMemory(),
IrMemoryArrayWriter(protoTypeArray.map { it.toByteArray() }).writeIntoMemory(),
IrMemoryArrayWriter(protoIdSignatureArray.map { it.toByteArray() }).writeIntoMemory(),
IrMemoryArrayWriter(protoStringArray.map { it.toByteArray() }).writeIntoMemory(),
IrMemoryArrayWriter(protoBodyArray.map { it.toByteArray() }).writeIntoMemory(),
IrMemoryDeclarationWriter(topLevelDeclarations).writeIntoMemory()
@@ -1357,10 +1290,7 @@ open class IrFileSerializer(
if (skipExpects) return
expectActualTable.table.forEach next@{ (expect, actualSymbol) ->
val expectSymbol = expectDescriptorToSymbol[expect]
?: error("Could not find expect symbol for expect descriptor $expect")
val expectDeclaration = expectSymbol.owner as IrDeclaration
val actualDeclaration = actualSymbol.owner as IrDeclaration
val expectSymbol = expectDescriptorToSymbol[expect] ?: error("Could not find expect symbol for expect descriptor $expect")
proto.addActuals(
ProtoActual.newBuilder()
@@ -0,0 +1,91 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.backend.common.serialization;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.metadata.ProtoBuf;
import org.jetbrains.kotlin.metadata.deserialization.Flags;
public class IrFlags extends Flags {
private IrFlags() {}
public static final BooleanFlagField IS_PRIMARY = FlagField.booleanAfter(IS_EXPECT_FUNCTION);
// Type Aliases
public static final BooleanFlagField IS_ACTUAL = FlagField.booleanAfter(VISIBILITY);
// Type Parameters
public static final FlagField<ProtoBuf.TypeParameter.Variance> VARIANCE = FlagField.after(HAS_ANNOTATIONS, ProtoBuf.TypeParameter.Variance.values());
public static final BooleanFlagField IS_REIFIED = FlagField.booleanAfter(VARIANCE);
// Fields
public static final BooleanFlagField IS_FINAL = FlagField.booleanAfter(VISIBILITY);
public static final BooleanFlagField IS_EXTERNAL_FIELD = FlagField.booleanAfter(IS_FINAL);
public static final BooleanFlagField IS_STATIC = FlagField.booleanAfter(IS_EXTERNAL_FIELD);
public static final BooleanFlagField IS_FAKE_OVERRIDE = FlagField.booleanAfter(IS_STATIC);
// Local variables
public static final BooleanFlagField IS_LOCAL_VAR = FlagField.booleanAfter(HAS_ANNOTATIONS);
public static final BooleanFlagField IS_LOCAL_CONST = FlagField.booleanAfter(IS_LOCAL_VAR);
public static final BooleanFlagField IS_LOCAL_LATEINIT = FlagField.booleanAfter(IS_LOCAL_CONST);
public static int getConstructorFlags(
boolean hasAnnotations,
@NotNull ProtoBuf.Visibility visibility,
boolean isInline,
boolean isExternal,
boolean isExpect,
boolean isPrimary
) {
return HAS_ANNOTATIONS.toFlags(hasAnnotations)
| VISIBILITY.toFlags(visibility)
| IS_INLINE.toFlags(isInline)
| IS_EXTERNAL_FUNCTION.toFlags(isExternal)
| IS_EXPECT_FUNCTION.toFlags(isExpect)
| IS_PRIMARY.toFlags(isPrimary)
;
}
public static int getTypeAliasFlags(boolean hasAnnotations, ProtoBuf.Visibility visibility, boolean isActual) {
return HAS_ANNOTATIONS.toFlags(hasAnnotations)
| VISIBILITY.toFlags(visibility)
| IS_ACTUAL.toFlags(isActual)
;
}
public static int getTypeParameterFlags(boolean hasAnnotations, ProtoBuf.TypeParameter.Variance variance, boolean isReified) {
return HAS_ANNOTATIONS.toFlags(hasAnnotations)
| VARIANCE.toFlags(variance)
| IS_REIFIED.toFlags(isReified)
;
}
public static int getFieldFlags(
boolean hasAnnotations,
ProtoBuf.Visibility visibility,
boolean isFinal,
boolean isExternal,
boolean isStatic,
boolean isFakeOverride
) {
return HAS_ANNOTATIONS.toFlags(hasAnnotations)
| VISIBILITY.toFlags(visibility)
| IS_FINAL.toFlags(isFinal)
| IS_EXTERNAL_FIELD.toFlags(isExternal)
| IS_STATIC.toFlags(isStatic)
| IS_FAKE_OVERRIDE.toFlags(isFakeOverride)
;
}
public static int getLocalFlags(boolean hasAnnotations, boolean isVar, boolean isConst, boolean isLateinit) {
return HAS_ANNOTATIONS.toFlags(hasAnnotations)
| IS_LOCAL_VAR.toFlags(isVar)
| IS_LOCAL_CONST.toFlags(isConst)
| IS_LOCAL_LATEINIT.toFlags(isLateinit)
;
}
}
@@ -1,11 +1,13 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.backend.common.serialization
import org.jetbrains.kotlin.backend.common.LoggingContext
import org.jetbrains.kotlin.backend.common.serialization.encodings.BinarySymbolData
import org.jetbrains.kotlin.builtins.functions.FunctionClassDescriptor
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.descriptors.impl.EmptyPackageFragmentDescriptor
import org.jetbrains.kotlin.ir.IrElement
@@ -26,45 +28,41 @@ import org.jetbrains.kotlin.ir.types.impl.IrErrorTypeImpl
import org.jetbrains.kotlin.ir.util.*
import org.jetbrains.kotlin.protobuf.ExtensionRegistryLite.newInstance
import org.jetbrains.kotlin.resolve.descriptorUtil.module
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedCallableMemberDescriptor
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedClassDescriptor
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
import org.jetbrains.kotlin.types.Variance
import org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference as ProtoDescriptorReference
import org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration as ProtoDeclaration
import org.jetbrains.kotlin.backend.common.serialization.proto.IrFile as ProtoFile
import org.jetbrains.kotlin.backend.common.serialization.proto.IrSymbolData as ProtoSymbolData
import org.jetbrains.kotlin.backend.common.serialization.proto.IrSymbolKind as ProtoSymbolKind
import org.jetbrains.kotlin.backend.common.serialization.proto.IrType as ProtoType
import org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement as ProtoStatement
import org.jetbrains.kotlin.backend.common.serialization.proto.IrExpression as ProtoExpression
import org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall as ProtoConstructorCall
import org.jetbrains.kotlin.backend.common.serialization.proto.Actual as ProtoActual
import org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature as ProtoIdSignature
abstract class KotlinIrLinker(
val logger: LoggingContext,
val builtIns: IrBuiltIns,
val symbolTable: SymbolTable,
private val exportedDependencies: List<ModuleDescriptor>,
private val forwardModuleDescriptor: ModuleDescriptor?,
mangler: KotlinMangler,
private val tolerateNonKlibDescriptors: Boolean = false
) : DescriptorUniqIdAware, IrDeserializer {
private val forwardModuleDescriptor: ModuleDescriptor?
) : IrDeserializer {
private val expectUniqIdToActualUniqId = mutableMapOf<UniqId, UniqId>()
private val topLevelActualUniqItToDeserializer = mutableMapOf<UniqId, IrModuleDeserializer>()
private val expectSymbols = mutableMapOf<UniqId, IrSymbol>()
private val actualSymbols = mutableMapOf<UniqId, IrSymbol>()
private val expectUniqIdToActualUniqId = mutableMapOf<IdSignature, IdSignature>()
private val topLevelActualUniqItToDeserializer = mutableMapOf<IdSignature, IrModuleDeserializer>()
private val expectSymbols = mutableMapOf<IdSignature, IrSymbol>()
private val actualSymbols = mutableMapOf<IdSignature, IrSymbol>()
sealed class DeserializationState<T> {
val deserializedSymbols = mutableMapOf<UniqId, IrSymbol>()
val deserializedSymbols = mutableMapOf<IdSignature, IrSymbol>()
operator fun contains(key: UniqId) = key in deserializedSymbols
operator fun get(key: UniqId): IrSymbol = deserializedSymbols[key] ?: error("No deserialized symbol found for $key")
operator fun contains(key: IdSignature) = key in deserializedSymbols
operator fun get(key: IdSignature): IrSymbol = deserializedSymbols[key] ?: error("No deserialized symbol found for $key")
abstract fun addUniqID(key: UniqId)
abstract fun addIdSignature(key: IdSignature)
abstract fun processPendingDeclarations(processor: (T) -> Unit)
class ModuleDeserializationState(val module: IrModuleDeserializer): DeserializationState<IrModuleDeserializer.IrDeserializerForFile>() {
class ModuleDeserializationState(val module: IrModuleDeserializer) :
DeserializationState<IrModuleDeserializer.IrDeserializerForFile>() {
private val filesWithPendingTopLevels = mutableSetOf<IrModuleDeserializer.IrDeserializerForFile>()
fun enqueueFile(fileDeserializer: IrModuleDeserializer.IrDeserializerForFile) {
@@ -72,9 +70,9 @@ abstract class KotlinIrLinker(
module.enqueueModule()
}
override fun addUniqID(key: UniqId) {
override fun addIdSignature(key: IdSignature) {
val fileDeserializer = module.moduleReversedFileIndex[key] ?: error("No file found for key $key")
fileDeserializer.fileLocalDeserializationState.addUniqID(key)
fileDeserializer.fileLocalDeserializationState.addIdSignature(key)
enqueueFile(fileDeserializer)
}
@@ -90,19 +88,24 @@ abstract class KotlinIrLinker(
}
}
class SimpleDeserializationState: DeserializationState<UniqId>() {
private val reachableTopLevels = LinkedHashSet<UniqId>()
class SimpleDeserializationState(private val checker: (IdSignature) -> Boolean) : DeserializationState<IdSignature>() {
private val reachableTopLevels = LinkedHashSet<IdSignature>()
override fun addUniqID(key: UniqId) {
private fun shouldBeProcessed(idSig: IdSignature): Boolean = checker(idSig)
override fun addIdSignature(key: IdSignature) {
reachableTopLevels.add(key)
}
override fun processPendingDeclarations(processor: (UniqId) -> Unit) {
override fun processPendingDeclarations(processor: (IdSignature) -> Unit) {
while (reachableTopLevels.isNotEmpty()) {
val reachableKey = reachableTopLevels.first()
if (deserializedSymbols[reachableKey]?.isBound != true) {
processor(reachableKey)
if (shouldBeProcessed(reachableKey)) {
val existedSymbol = deserializedSymbols[reachableKey]
if (existedSymbol == null || !existedSymbol.isBound) {
processor(reachableKey)
}
}
reachableTopLevels.remove(reachableKey)
@@ -111,34 +114,28 @@ abstract class KotlinIrLinker(
}
}
protected val globalDeserializationState = DeserializationState.SimpleDeserializationState()
protected val globalDeserializationState = DeserializationState.SimpleDeserializationState { true }
private val modulesWithReachableTopLevels = mutableSetOf<IrModuleDeserializer>()
//TODO: This is Native specific. Eliminate me.
private val forwardDeclarations = mutableSetOf<IrSymbol>()
val resolvedForwardDeclarations = mutableMapOf<UniqId, UniqId>()
protected val deserializersForModules = mutableMapOf<ModuleDescriptor, IrModuleDeserializer>()
private fun getForwardDeclararationModuleDeserializer() = deserializersForModules.entries.single { it.key.isForwardDeclarationModule }.value
inner class IrModuleDeserializer(
abstract inner class IrModuleDeserializer(
private val moduleDescriptor: ModuleDescriptor,
private val deserializationStrategy: DeserializationStrategy
) {
private val strategy: DeserializationStrategy) {
val fileToDeserializerMap = mutableMapOf<IrFile, IrDeserializerForFile>()
protected val moduleResolvedForwardDeclarations = mutableMapOf<UniqId, UniqId>()
private val moduleDeserializationState = DeserializationState.ModuleDeserializationState(this)
val moduleReversedFileIndex = mutableMapOf<UniqId, IrDeserializerForFile>()
val moduleReversedFileIndex = mutableMapOf<IdSignature, IrDeserializerForFile>()
private val moduleDependencies by lazy {
moduleDescriptor.allDependencyModules.filter { it != moduleDescriptor }.mapNotNull {
deserializersForModules[it] ?: if (tolerateNonKlibDescriptors) null else error("Module without deserializer $it")
}
moduleDescriptor.allDependencyModules.filter { it != moduleDescriptor }.mapNotNull { resolveModuleDeserializer(it) }
}
protected open fun containsIdSignature(idSig: IdSignature): Boolean = idSig in moduleReversedFileIndex
// This is a heavy initializer
val module = deserializeIrModuleHeader()
@@ -151,45 +148,47 @@ abstract class KotlinIrLinker(
private var fileLoops = mutableMapOf<Int, IrLoopBase>()
private val symbolProtosCache = mutableMapOf<Int, ProtoSymbolData>()
private val typeProtosCache = mutableMapOf<Int, ProtoType>()
private val stringsCache = mutableMapOf<Int, String>()
lateinit var file: IrFile
private val deserializeBodies: Boolean = !onlyHeaders
private val fileLocalResolvedForwardDeclarations = mutableMapOf<UniqId, UniqId>()
private val irTypeCache = mutableMapOf<Int, IrType>()
val fileLocalDeserializationState = DeserializationState.SimpleDeserializationState()
var reversedSignatureIndex = emptyMap<IdSignature, Int>()
fun deserializeDeclaration(key: UniqId): IrDeclaration {
return deserializeDeclaration(loadTopLevelDeclarationProto(key), file)
val fileLocalDeserializationState = DeserializationState.SimpleDeserializationState {
moduleDeserializationState.deserializedSymbols[it]?.isBound != true
}
fun deserializeDeclaration(idSig: IdSignature): IrDeclaration {
return deserializeDeclaration(loadTopLevelDeclarationProto(idSig), file)
}
fun deserializeExpectActualMapping() {
actuals.forEach {
val expectSymbol = loadSymbolProto(it.expectSymbol)
val actualSymbol = loadSymbolProto(it.actualSymbol)
val expect = UniqId(expectSymbol.uniqIdIndex)
val actual = UniqId(actualSymbol.uniqIdIndex)
val expectSymbol = parseSymbolData(it.expectSymbol)
val actualSymbol = parseSymbolData(it.actualSymbol)
val expect = deserializeIdSignature(expectSymbol.signatureId)
val actual = deserializeIdSignature(actualSymbol.signatureId)
assert(expectUniqIdToActualUniqId[expect] == null) {
"Expect uniqid ${expect.index} is already actualized by ${expectUniqIdToActualUniqId[expect]?.index}, while we try to record ${actual.index}"
"Expect signature $expect is already actualized by ${expectUniqIdToActualUniqId[expect]}, while we try to record $actual"
}
expectUniqIdToActualUniqId.put(expect, actual)
expectUniqIdToActualUniqId[expect] = actual
// Non-null only for topLevel declarations.
getModuleForTopLevelId(actual)?. let { topLevelActualUniqItToDeserializer.put(actual, it) }
getModuleForTopLevelId(actual)?.let { md -> topLevelActualUniqItToDeserializer[actual] = md }
}
}
private fun loadTopLevelDeclarationProto(uniqId: UniqId): ProtoDeclaration {
val stream = reader(moduleDescriptor, fileIndex, uniqId).codedInputStream
return ProtoDeclaration.parseFrom(stream, newInstance())
private fun resolveSignatureIndex(idSig: IdSignature): Int {
return reversedSignatureIndex[idSig] ?: error("Not found Idx for $idSig")
}
private fun loadSymbolProto(index: Int): ProtoSymbolData {
val stream = readSymbol(moduleDescriptor, fileIndex, index).codedInputStream
return ProtoSymbolData.parseFrom(stream, newInstance())
private fun loadTopLevelDeclarationProto(idSig: IdSignature): ProtoDeclaration {
val idSigIndex = resolveSignatureIndex(idSig)
val stream = reader(moduleDescriptor, fileIndex, idSigIndex).codedInputStream
return ProtoDeclaration.parseFrom(stream, newInstance())
}
private fun loadTypeProto(index: Int): ProtoType {
@@ -197,6 +196,11 @@ abstract class KotlinIrLinker(
return ProtoType.parseFrom(stream, newInstance())
}
private fun loadSignatureProto(index: Int): ProtoIdSignature {
val stream = readSignature(moduleDescriptor, fileIndex, index).codedInputStream
return ProtoIdSignature.parseFrom(stream, newInstance())
}
private fun loadStatementBodyProto(index: Int): ProtoStatement {
val stream = readBody(moduleDescriptor, fileIndex, index).codedInputStream
return ProtoStatement.parseFrom(stream, newInstance())
@@ -212,144 +216,104 @@ abstract class KotlinIrLinker(
}
private fun referenceDeserializedSymbol(
proto: ProtoSymbolData,
symbolKind: BinarySymbolData.SymbolKind,
idSig: IdSignature,
descriptor: DeclarationDescriptor?
): IrSymbol = when (proto.kind) {
ProtoSymbolKind.ANONYMOUS_INIT_SYMBOL ->
IrAnonymousInitializerSymbolImpl(
descriptor as ClassDescriptor?
?: WrappedClassDescriptor()
)
ProtoSymbolKind.CLASS_SYMBOL ->
symbolTable.referenceClass(
descriptor as ClassDescriptor?
?: WrappedClassDescriptor()
)
ProtoSymbolKind.CONSTRUCTOR_SYMBOL ->
symbolTable.referenceConstructor(
descriptor as ClassConstructorDescriptor?
?: WrappedClassConstructorDescriptor()
)
ProtoSymbolKind.TYPE_PARAMETER_SYMBOL ->
symbolTable.referenceTypeParameter(
descriptor as TypeParameterDescriptor?
?: WrappedTypeParameterDescriptor()
)
ProtoSymbolKind.ENUM_ENTRY_SYMBOL ->
symbolTable.referenceEnumEntry(
descriptor as ClassDescriptor?
?: WrappedEnumEntryDescriptor()
)
ProtoSymbolKind.STANDALONE_FIELD_SYMBOL ->
symbolTable.referenceField(WrappedFieldDescriptor())
ProtoSymbolKind.FIELD_SYMBOL ->
symbolTable.referenceField(
descriptor as PropertyDescriptor?
?: WrappedPropertyDescriptor()
)
ProtoSymbolKind.FUNCTION_SYMBOL ->
symbolTable.referenceSimpleFunction(
descriptor as FunctionDescriptor?
?: WrappedSimpleFunctionDescriptor()
)
ProtoSymbolKind.TYPEALIAS_SYMBOL ->
symbolTable.referenceTypeAlias(
descriptor as TypeAliasDescriptor?
?: WrappedTypeAliasDescriptor()
)
ProtoSymbolKind.VARIABLE_SYMBOL ->
IrVariableSymbolImpl(
descriptor as VariableDescriptor?
?: WrappedVariableDescriptor()
)
ProtoSymbolKind.VALUE_PARAMETER_SYMBOL ->
IrValueParameterSymbolImpl(
descriptor as ParameterDescriptor?
?: WrappedValueParameterDescriptor()
)
ProtoSymbolKind.RECEIVER_PARAMETER_SYMBOL ->
IrValueParameterSymbolImpl(
descriptor as ParameterDescriptor? ?: WrappedReceiverParameterDescriptor()
)
ProtoSymbolKind.PROPERTY_SYMBOL ->
symbolTable.referenceProperty(
descriptor as PropertyDescriptor? ?: WrappedPropertyDescriptor()
)
ProtoSymbolKind.LOCAL_DELEGATED_PROPERTY_SYMBOL ->
IrLocalDelegatedPropertySymbolImpl(
descriptor as? VariableDescriptorWithAccessors ?: WrappedVariableDescriptorWithAccessor()
)
else -> TODO("Unexpected classifier symbol kind: ${proto.kind}")
}
fun loadSymbolData(index: Int): ProtoSymbolData {
return symbolProtosCache.getOrPut(index) {
loadSymbolProto(index)
}
}
private fun loadTypeData(index: Int): ProtoType {
return typeProtosCache.getOrPut(index) {
loadTypeProto(index)
}
}
private fun loadString(index: Int): String {
return stringsCache.getOrPut(index) {
loadStringProto(index)
}
}
private fun isGlobalUniqID(uniqId: UniqId): Boolean {
return uniqId in globalDeserializationState ||
descriptorReferenceDeserializer.checkIfSpecialDescriptorId(uniqId.index)
}
private fun getModuleForTopLevelId(key: UniqId): IrModuleDeserializer? {
if (key in moduleReversedFileIndex) return this@IrModuleDeserializer
return moduleDependencies.firstOrNull { key in it.moduleReversedFileIndex }
}
private fun getStateForID(key: UniqId): DeserializationState<*> {
if (key.isLocal) return fileLocalDeserializationState
if (isGlobalUniqID(key)) return globalDeserializationState
return getModuleForTopLevelId(key)?.moduleDeserializationState ?: handleNoModuleDeserializerFound(key)
}
private fun deserializeIrSymbolData(proto: ProtoSymbolData): IrSymbol {
val key = UniqId(proto.uniqIdIndex)
val topLevelKey = UniqId(proto.topLevelUniqIdIndex)
val topLevelDeserializationState = getStateForID(topLevelKey)
if (topLevelKey !in topLevelDeserializationState) {
topLevelDeserializationState.addUniqID(topLevelKey)
) =
symbolTable.run {
when (symbolKind) {
BinarySymbolData.SymbolKind.ANONYMOUS_INIT_SYMBOL ->
IrAnonymousInitializerSymbolImpl(WrappedClassDescriptor()).also { require(idSig.isLocal) }
BinarySymbolData.SymbolKind.CLASS_SYMBOL -> // TODO: FunctionInterfaces
referenceClassFromLinker(descriptor as ClassDescriptor? ?: WrappedClassDescriptor(), idSig)
BinarySymbolData.SymbolKind.CONSTRUCTOR_SYMBOL ->
referenceConstructorFromLinker(WrappedClassConstructorDescriptor(), idSig)
BinarySymbolData.SymbolKind.TYPE_PARAMETER_SYMBOL ->
referenceTypeParameterFromLinker(WrappedTypeParameterDescriptor(), idSig)
BinarySymbolData
.SymbolKind.ENUM_ENTRY_SYMBOL -> referenceEnumEntryFromLinker(WrappedEnumEntryDescriptor(), idSig)
BinarySymbolData
.SymbolKind.STANDALONE_FIELD_SYMBOL -> referenceFieldFromLinker(WrappedFieldDescriptor(), idSig)
BinarySymbolData
.SymbolKind.FIELD_SYMBOL -> referenceFieldFromLinker(WrappedPropertyDescriptor(), idSig)
BinarySymbolData.SymbolKind.FUNCTION_SYMBOL -> //TODO: FunctionInterfaces
referenceSimpleFunctionFromLinker(descriptor as FunctionDescriptor? ?: WrappedSimpleFunctionDescriptor(), idSig)
BinarySymbolData
.SymbolKind.TYPEALIAS_SYMBOL -> referenceTypeAliasFromLinker(WrappedTypeAliasDescriptor(), idSig)
BinarySymbolData
.SymbolKind.PROPERTY_SYMBOL -> referencePropertyFromLinker(WrappedPropertyDescriptor(), idSig)
BinarySymbolData
.SymbolKind.VARIABLE_SYMBOL -> IrVariableSymbolImpl(WrappedVariableDescriptor())
BinarySymbolData
.SymbolKind.VALUE_PARAMETER_SYMBOL -> IrValueParameterSymbolImpl(WrappedValueParameterDescriptor())
BinarySymbolData.SymbolKind.RECEIVER_PARAMETER_SYMBOL ->
IrValueParameterSymbolImpl(WrappedReceiverParameterDescriptor())
BinarySymbolData.SymbolKind.LOCAL_DELEGATED_PROPERTY_SYMBOL ->
IrLocalDelegatedPropertySymbolImpl(WrappedVariableDescriptorWithAccessor())
else -> TODO("Unexpected classifier symbol kind: $symbolKind")
}
}
// If topLevel declaration is module-public and current declaration in not (e.g. value parameter)
// they should be proccesed via different tables
val deserializationState =
if (topLevelKey.isLocal xor key.isLocal) getStateForID(key) else topLevelDeserializationState
private fun isGlobalIdSignature(isSignature: IdSignature): Boolean {
return isSignature in globalDeserializationState || isSpecialSignature(isSignature)
}
val symbol = deserializationState.deserializedSymbols.getOrPut(key) {
val descriptor = if (proto.hasDescriptorReference()) {
deserializeDescriptorReference(proto.descriptorReference)
} else {
null
private fun getModuleForTopLevelId(idSignature: IdSignature): IrModuleDeserializer? {
if (containsIdSignature(idSignature)) return this@IrModuleDeserializer
return moduleDependencies.firstOrNull { it.containsIdSignature(idSignature) }
}
private fun getStateForID(isSignature: IdSignature): DeserializationState<*> {
if (isSignature.isLocal) return fileLocalDeserializationState
if (isGlobalIdSignature(isSignature)) return globalDeserializationState
return getModuleForTopLevelId(isSignature)?.moduleDeserializationState ?: handleNoModuleDeserializerFound(isSignature)
}
private fun findDeserializationState(idSignature: IdSignature): DeserializationState<*> {
if (idSignature.hasTopLevel) {
val topLevelSignature = idSignature.topLevelSignature()
val topLevelDeserializationState = getStateForID(topLevelSignature)
if (topLevelSignature !in topLevelDeserializationState) {
topLevelDeserializationState.addIdSignature(topLevelSignature)
}
resolvedForwardDeclarations[key]?.let {
// If topLevel declaration is module-public and current declaration iы not (e.g. value parameter)
// they should be processed via different tables
if (idSignature.isLocal) return fileLocalDeserializationState
return topLevelDeserializationState
}
assert(idSignature.isLocal)
return fileLocalDeserializationState
}
private fun referenceIrSymbolData(symbol: IrSymbol, signature: IdSignature) {
val deserializationState = findDeserializationState(signature)
deserializationState.deserializedSymbols.putIfAbsent(signature, symbol)
}
private fun deserializeIrSymbolData(idSignature: IdSignature, symbolKind: BinarySymbolData.SymbolKind): IrSymbol {
val deserializationState = findDeserializationState(idSignature)
val symbol = deserializationState.deserializedSymbols.getOrPut(idSignature) {
val descriptor = resolveSpecialSignature(idSignature)
// TODO: move this logic out there
postProcessPlatformSpecificDeclaration(idSignature, descriptor) {
val fdState = getStateForID(it)
if (it !in fdState) fdState.addUniqID(it)
assert(it.isPublic && it.topLevelSignature() == it)
if (it !in fdState) fdState.addIdSignature(it)
}
val symbol = referenceDeserializedSymbol(proto, descriptor).let {
if (expectUniqIdToActualUniqId[key] != null) wrapInDelegatedSymbol(it) else it
val symbol = referenceDeserializedSymbol(symbolKind, idSignature, descriptor).let {
if (expectUniqIdToActualUniqId[idSignature] != null) wrapInDelegatedSymbol(it) else it
}
if (key in expectUniqIdToActualUniqId.keys) expectSymbols.put(key, symbol)
if (key in expectUniqIdToActualUniqId.values) actualSymbols.put(key, symbol)
if (idSignature in expectUniqIdToActualUniqId.keys) expectSymbols[idSignature] = symbol
if (idSignature in expectUniqIdToActualUniqId.values) actualSymbols[idSignature] = symbol
symbol
}
@@ -363,23 +327,30 @@ abstract class KotlinIrLinker(
return symbol
}
override fun deserializeDescriptorReference(proto: ProtoDescriptorReference) =
descriptorReferenceDeserializer.deserializeDescriptorReference(
deserializeFqName(proto.packageFqNameList),
deserializeFqName(proto.classFqNameList),
deserializeString(proto.name),
proto.flags,
if (proto.hasUniqIdIndex()) proto.uniqIdIndex else null
)
override fun deserializeIrSymbolToDeclare(code: Long): Pair<IrSymbol, IdSignature> {
val symbolData = parseSymbolData(code)
val signature = deserializeIdSignature(symbolData.signatureId)
return Pair(deserializeIrSymbolData(signature, symbolData.kind), signature)
}
override fun deserializeIrSymbol(index: Int): IrSymbol {
val symbolData = loadSymbolProto(index)
return deserializeIrSymbolData(symbolData)
fun parseSymbolData(code: Long): BinarySymbolData = BinarySymbolData.decode(code)
override fun deserializeIrSymbol(code: Long): IrSymbol {
val symbolData = parseSymbolData(code)
val signature = deserializeIdSignature(symbolData.signatureId)
return deserializeIrSymbolData(signature, symbolData.kind)
}
override fun deserializeIrType(index: Int): IrType {
val typeData = loadTypeProto(index)
return deserializeIrTypeData(typeData)
return irTypeCache.getOrPut(index) {
val typeData = loadTypeProto(index)
deserializeIrTypeData(typeData)
}
}
override fun deserializeIdSignature(index: Int): IdSignature {
val sigData = loadSignatureProto(index)
return deserializeSignatureData(sigData)
}
override fun deserializeString(index: Int): String =
@@ -389,12 +360,12 @@ abstract class KotlinIrLinker(
fileLoops.getOrPut(loopIndex, loopBuilder)
override fun deserializeExpressionBody(index: Int): IrExpression {
if (deserializeBodies) {
return if (deserializeBodies) {
val bodyData = loadExpressionBodyProto(index)
return deserializeExpression(bodyData)
deserializeExpression(bodyData)
} else {
val errorType = IrErrorTypeImpl(null, emptyList(), Variance.INVARIANT)
return IrErrorExpressionImpl(-1, -1, errorType, "Expression body is not deserialized yet")
IrErrorExpressionImpl(-1, -1, errorType, "Expression body is not deserialized yet")
}
}
@@ -408,6 +379,10 @@ abstract class KotlinIrLinker(
}
}
override fun referenceIrSymbol(symbol: IrSymbol, signature: IdSignature) {
referenceIrSymbolData(symbol, signature)
}
fun deserializeFileImplicitDataIfFirstUse() {
annotations?.let {
file.annotations += deserializeAnnotations(it)
@@ -430,12 +405,15 @@ abstract class KotlinIrLinker(
val fileEntry = NaiveSourceBasedFileEntryImpl(fileName, fileProto.fileEntry.lineStartOffsetsList.toIntArray())
val fileDeserializer =
IrDeserializerForFile(fileProto.annotationList, fileProto.actualsList, fileIndex, !deserializationStrategy.needBodies).apply {
IrDeserializerForFile(fileProto.annotationList, fileProto.actualsList, fileIndex, !strategy.needBodies).apply {
// Explicitly exported declarations (e.g. top-level initializers) must be deserialized before all other declarations.
// Thus we schedule their deserialization in deserializer's constructor.
fileProto.explicitlyExportedToCompilerList.forEach {
fileLocalDeserializationState.addUniqID(UniqId(loadSymbolData(it).topLevelUniqIdIndex))
val symbolData = parseSymbolData(it)
val sig = deserializeIdSignature(symbolData.signatureId)
assert(!sig.isPackageSignature())
fileLocalDeserializationState.addIdSignature(sig.topLevelSignature())
}
}
@@ -449,19 +427,20 @@ abstract class KotlinIrLinker(
fileDeserializer.file = file
fileToDeserializerMap[file] = fileDeserializer
val fileUniqIdIndex = fileProto.declarationIdList.map { UniqId(it) }
val fileSignatureIndex = fileProto.declarationIdList.map { fileDeserializer.deserializeIdSignature(it) to it }
fileUniqIdIndex.forEach {
moduleReversedFileIndex.getOrPut(it) { fileDeserializer }
fileSignatureIndex.forEach {
moduleReversedFileIndex.getOrPut(it.first) { fileDeserializer }
}
if (deserializationStrategy.theWholeWorld) {
for (id in fileUniqIdIndex) {
assert(id.isPublic)
moduleDeserializationState.addUniqID(id)
fileDeserializer.reversedSignatureIndex = fileSignatureIndex.toMap()
if (strategy.theWholeWorld) {
for (id in fileSignatureIndex) {
moduleDeserializationState.addIdSignature(id.first)
}
moduleDeserializationState.enqueueFile(fileDeserializer)
} else if (deserializationStrategy.explicitlyExported) {
} else if (strategy.explicitlyExported) {
moduleDeserializationState.enqueueFile(fileDeserializer)
}
@@ -471,7 +450,7 @@ abstract class KotlinIrLinker(
private fun deserializeIrModuleHeader(): IrModuleFragment {
val fileCount = readFileCount(moduleDescriptor)
val files = mutableListOf<IrFile>()
val files = ArrayList<IrFile>(fileCount)
for (i in 0 until fileCount) {
files.add(deserializeIrFile(ProtoFile.parseFrom(readFile(moduleDescriptor, i), newInstance()), i))
@@ -491,25 +470,22 @@ abstract class KotlinIrLinker(
modulesWithReachableTopLevels.add(this)
}
fun addModuleReachableTopLevel(key: UniqId) {
moduleDeserializationState.addUniqID(key)
fun addModuleReachableTopLevel(idSig: IdSignature) {
moduleDeserializationState.addIdSignature(idSig)
}
}
protected abstract val descriptorReferenceDeserializer: DescriptorReferenceDeserializer
private fun loadKnownBuiltinSymbols(mangler: KotlinMangler) {
val mask = 1L shl 63
private fun loadKnownBuiltinSymbols() {
val globalDeserializedSymbols = globalDeserializationState.deserializedSymbols
builtIns.knownBuiltins.forEach {
val currentIndex = with(mangler) { it.mangle.hashMangle }
globalDeserializedSymbols[UniqId(currentIndex or mask)] = it.symbol
assert(symbolTable.referenceSimpleFunction(it.symbol.descriptor as SimpleFunctionDescriptor).owner === it)
val symbol = (it as IrSymbolOwner).symbol
val signature = symbol.signature
globalDeserializedSymbols[signature] = symbol
}
}
init {
loadKnownBuiltinSymbols(mangler)
loadKnownBuiltinSymbols()
}
private val ByteArray.codedInputStream: org.jetbrains.kotlin.protobuf.CodedInputStream
@@ -519,23 +495,95 @@ abstract class KotlinIrLinker(
return codedInputStream
}
protected abstract fun reader(moduleDescriptor: ModuleDescriptor, fileIndex: Int, uniqId: UniqId): ByteArray
protected abstract fun readSymbol(moduleDescriptor: ModuleDescriptor, fileIndex: Int, symbolIndex: Int): ByteArray
protected abstract fun reader(moduleDescriptor: ModuleDescriptor, fileIndex: Int, idSigIndex: Int): ByteArray
protected abstract fun readType(moduleDescriptor: ModuleDescriptor, fileIndex: Int, typeIndex: Int): ByteArray
protected abstract fun readSignature(moduleDescriptor: ModuleDescriptor, fileIndex: Int, signatureIndex: Int): ByteArray
protected abstract fun readString(moduleDescriptor: ModuleDescriptor, fileIndex: Int, stringIndex: Int): ByteArray
protected abstract fun readBody(moduleDescriptor: ModuleDescriptor, fileIndex: Int, bodyIndex: Int): ByteArray
protected abstract fun readFile(moduleDescriptor: ModuleDescriptor, fileIndex: Int): ByteArray
protected abstract fun readFileCount(moduleDescriptor: ModuleDescriptor): Int
protected open fun handleNoModuleDeserializerFound(key: UniqId): DeserializationState<*> {
error("Deserializer for declaration $key is not found")
protected open fun handleNoModuleDeserializerFound(idSignature: IdSignature): DeserializationState<*> {
error("Deserializer for declaration $idSignature is not found")
}
protected open fun resolveModuleDeserializer(moduleDescriptor: ModuleDescriptor): IrModuleDeserializer? {
return deserializersForModules[moduleDescriptor] ?: error("No module deserializer found for $moduleDescriptor")
}
protected abstract fun createModuleDeserializer(
moduleDescriptor: ModuleDescriptor,
strategy: DeserializationStrategy,
): IrModuleDeserializer
// TODO: the following code worths some refactoring in the nearest future
private fun isSpecialSignature(idSig: IdSignature): Boolean {
return isSpecialPlatformSignature(idSig) || isSpecialFunctionDescriptor(idSig)
}
private fun resolveSpecialSignature(idSig: IdSignature): DeclarationDescriptor? {
return resolvePlatformDescriptor(idSig) ?: resolveFunctionDescriptor(idSig)
}
protected open fun resolvePlatformDescriptor(idSig: IdSignature): DeclarationDescriptor? = null
protected open fun isSpecialPlatformSignature(idSig: IdSignature): Boolean = false
protected open fun postProcessPlatformSpecificDeclaration(idSig: IdSignature, descriptor: DeclarationDescriptor?, block: (IdSignature) -> Unit) {
}
private fun isSpecialFunctionDescriptor(idSig: IdSignature): Boolean {
val publicSig = idSig.asPublic() ?: return false
if (publicSig.packageFqn !in functionalPackages) return false
val classFqn = publicSig.classFqn
if (classFqn.isRoot) return false
val fqnParts = classFqn.pathSegments()
val className = fqnParts.first()
return functionPattern.matcher(className.asString()).find()
}
private fun resolveFunctionDescriptor(idSig: IdSignature): DeclarationDescriptor? {
if (isSpecialFunctionDescriptor(idSig)) {
val publicSig = idSig.asPublic() ?: error("$idSig has to be public")
val fqnParts = publicSig.classFqn.pathSegments()
val className = fqnParts.first()
val classDescriptor = builtIns.builtIns.getBuiltInClassByFqName(publicSig.packageFqn.child(className))
fun findMemberDescriptor(): DeclarationDescriptor {
val memberName = fqnParts[1]!!
val memberDescriptors = classDescriptor.unsubstitutedMemberScope.getContributedDescriptors(DescriptorKindFilter.CALLABLES).filter { d -> d.name == memberName }
return memberDescriptors.single()
}
return when (fqnParts.size) {
1 -> classDescriptor
2 -> findMemberDescriptor()
3 -> {
assert(idSig is IdSignature.AccessorSignature)
val propertyDescriptor = findMemberDescriptor() as PropertyDescriptor
val accessorName = fqnParts[2]
propertyDescriptor.accessors.single { it.name == accessorName }
}
else -> error("No member found for signature $idSig")
}
}
return null
}
/**
* Check that descriptor shouldn't be processed by some backend-specific logic.
* For example, it is the case for Native interop libraries where there is no IR in libraries.
*/
protected open fun DeclarationDescriptor.shouldBeDeserialized(): Boolean = true
protected open fun IdSignature.shouldBeDeserialized(): Boolean = true
private fun deserializeAllReachableTopLevels() {
do {
@@ -546,53 +594,42 @@ abstract class KotlinIrLinker(
} while (modulesWithReachableTopLevels.isNotEmpty())
}
private fun findDeserializedDeclarationForDescriptor(descriptor: DeclarationDescriptor): DeclarationDescriptor? {
val topLevelDescriptor = descriptor.findTopLevelDescriptor() as DeclarationDescriptorWithVisibility
private fun findDeserializedDeclarationForSymbol(symbol: IrSymbol): DeclarationDescriptor? {
require(symbol.isPublicApi)
val signature = symbol.signature
// This is Native specific. Try to eliminate.
if (topLevelDescriptor.module.isForwardDeclarationModule) return null
if (!signature.shouldBeDeserialized()) return null
//
if (!topLevelDescriptor.shouldBeDeserialized()) return null
if (topLevelDescriptor !is DeserializedClassDescriptor && topLevelDescriptor !is DeserializedCallableMemberDescriptor) {
val descriptor = symbol.descriptor
if (descriptor is FunctionClassDescriptor || (descriptor.containingDeclaration is FunctionClassDescriptor)) {
return null
}
val moduleOfOrigin = topLevelDescriptor.module
val topLevelSignature = signature.topLevelSignature()
val moduleDeserializer = resolveModuleDeserializer(descriptor.module) ?: return null
val moduleDeserializer = deserializersForModules[moduleOfOrigin] ?:
if (tolerateNonKlibDescriptors) {
return null
} else {
error("No module deserializer found for $moduleOfOrigin")
}
val descriptorUniqId = topLevelDescriptor.getUniqId()
?: if (tolerateNonKlibDescriptors) {
return null
} else {
error("Could not get descriptor uniq id for $topLevelDescriptor")
}
val topLevelKey = UniqId(descriptorUniqId)
moduleDeserializer.addModuleReachableTopLevel(topLevelKey)
moduleDeserializer.addModuleReachableTopLevel(topLevelSignature)
deserializeAllReachableTopLevels()
return topLevelDescriptor
return descriptor
}
override fun getDeclaration(symbol: IrSymbol): IrDeclaration? {
if (!symbol.isPublicApi) return null
if (!symbol.isBound) {
findDeserializedDeclarationForDescriptor(symbol.descriptor) ?: return null
findDeserializedDeclarationForSymbol(symbol) ?: return null
}
// TODO: we do have serializations for those, but let's just create a stub for now.
if (!symbol.isBound && (symbol.descriptor.isExpectMember || symbol.descriptor.containingDeclaration?.isExpectMember ?: false)) return null
if (!symbol.isBound && (symbol.descriptor.isExpectMember || symbol.descriptor.containingDeclaration?.isExpectMember == true))
return null
assert(symbol.isBound) {
"getDeclaration: symbol ${symbol} is unbound, descriptor = ${symbol.descriptor}, hash = ${symbol.descriptor.hashCode()}"
"getDeclaration: symbol $symbol is unbound, descriptor = ${symbol.descriptor}, signature = ${symbol.signature}"
}
return symbol.owner as IrDeclaration
@@ -681,7 +718,7 @@ abstract class KotlinIrLinker(
deserializationStrategy: DeserializationStrategy = DeserializationStrategy.ONLY_REFERENCED
): IrModuleFragment {
val deserializerForModule = deserializersForModules.getOrPut(moduleDescriptor) {
IrModuleDeserializer(moduleDescriptor, deserializationStrategy)
createModuleDeserializer(moduleDescriptor, deserializationStrategy)
}
// The IrModule and its IrFiles have been created during module initialization.
return deserializerForModule.module
@@ -30,25 +30,10 @@ tailrec fun DeclarationDescriptor.findPackage(): PackageFragmentDescriptor {
}
fun DeclarationDescriptor.findTopLevelDescriptor(): DeclarationDescriptor {
return if (this.containingDeclaration is org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor) this.propertyIfAccessor
return if (this.containingDeclaration is PackageFragmentDescriptor) this.propertyIfAccessor
else this.containingDeclaration!!.findTopLevelDescriptor()
}
/**
* TODO: this method is actually a part of resolve and probably duplicates another one
*/
internal fun <T : CallableMemberDescriptor> T.resolveFakeOverrideMaybeAbstract(): Set<T> {
if (this.kind.isReal) {
return setOf(this)
} else {
val overridden = OverridingUtil.getOverriddenDeclarations(this)
val filtered = OverridingUtil.filterOutOverridden(overridden)
// TODO: is it correct to take first?
@Suppress("UNCHECKED_CAST")
return filtered as Set<T>
}
}
// This is Native specific. Try to eliminate.
val ModuleDescriptor.isForwardDeclarationModule get() =
name == Name.special("<forward declarations>")
@@ -1,138 +0,0 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.backend.common.serialization
import org.jetbrains.kotlin.backend.common.ir.isExpect
import org.jetbrains.kotlin.backend.common.ir.isProperExpect
import org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference as ProtoDescriptorReference
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.util.isAccessor
import org.jetbrains.kotlin.ir.util.isGetter
import org.jetbrains.kotlin.ir.util.isSetter
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.resolve.DescriptorFactory
import org.jetbrains.kotlin.resolve.descriptorUtil.classId
open class DescriptorReferenceSerializer(
val declarationTable: DeclarationTable,
val serializeString: (String) -> Int,
val serializeFqName: (FqName) -> List<Int>,
val skipExpects: Boolean
) {
private fun isEnumSpecialMember(descriptor: DeclarationDescriptor): Boolean {
if (descriptor !is SimpleFunctionDescriptor) return false
return DescriptorFactory.isEnumValueOfMethod(descriptor) || DescriptorFactory.isEnumValuesMethod(descriptor)
}
fun extractPackageAndClassFqns(descriptor: DeclarationDescriptor): Pair<FqName, FqName>? {
val containingDeclaration = descriptor.containingDeclaration
return when (containingDeclaration) {
is ClassDescriptor -> {
val classId = containingDeclaration.classId ?: return null
Pair(classId.packageFqName, classId.relativeClassName)
}
is PackageFragmentDescriptor -> Pair(containingDeclaration.fqName, FqName.ROOT)
is PropertyDescriptor -> if (descriptor !is TypeParameterDescriptor) null else {
extractPackageAndClassFqns(containingDeclaration)
}
else -> return null
}
}
// Not all exported descriptors are deserialized, some a synthesized anew during metadata deserialization.
// Those created descriptors can't carry the uniqIdIndex, since it is available only for deserialized descriptors.
// So we record the uniq id of some other "discoverable" descriptor for which we know for sure that it will be
// available as deserialized descriptor, plus the path to find the needed descriptor from that one.
fun serializeDescriptorReference(declaration: IrDeclaration): ProtoDescriptorReference? {
val descriptor = declaration.descriptor
if (!declarationTable.isExportedDeclaration(declaration) &&
!((declaration as? IrDeclarationWithVisibility)?.visibility == Visibilities.INVISIBLE_FAKE)) {
return null
}
if (declaration is IrAnonymousInitializer) return null
if (descriptor is ParameterDescriptor || (descriptor is VariableDescriptor && descriptor !is PropertyDescriptor)) return null
val containingDeclaration = descriptor.containingDeclaration!!
val (packageFqName, classFqName) = extractPackageAndClassFqns(descriptor) ?: return null
val isAccessor = declaration.isAccessor
val isBackingField = declaration is IrField && declaration.correspondingPropertySymbol != null
val isFakeOverride = declaration.origin == IrDeclarationOrigin.FAKE_OVERRIDE
val isDefaultConstructor = descriptor is ClassConstructorDescriptor && containingDeclaration is ClassDescriptor && (containingDeclaration.kind == ClassKind.OBJECT)
val isEnumEntry = descriptor is ClassDescriptor && descriptor.kind == ClassKind.ENUM_ENTRY
val isEnumSpecial = isEnumSpecialMember(descriptor)
val isTypeParameter = declaration is IrTypeParameter
// The corresponding descriptor in deserialized metadata has constructors = emptyList() etc.
if (containingDeclaration is ClassDescriptor &&
containingDeclaration.kind == ClassKind.ENUM_ENTRY &&
!isFakeOverride) return null
val realDeclaration = if (isFakeOverride) {
when (declaration) {
is IrSimpleFunction -> declaration.resolveFakeOverrideMaybeAbstract()
is IrField -> declaration.resolveFakeOverride()
is IrProperty -> declaration.resolveFakeOverrideMaybeAbstract()
else -> error("Unexpected fake override declaration")
}
} else {
declaration
}
val discoverableDescriptorsDeclaration: IrDeclaration? = if (isAccessor) {
(realDeclaration as IrSimpleFunction).correspondingPropertySymbol!!.owner
} else if (isBackingField) {
(realDeclaration as IrField).correspondingPropertySymbol!!.owner
} else if (isDefaultConstructor || isEnumEntry) {
null
} else {
realDeclaration
}
val nameString = if (isTypeParameter) {
val parent = declaration.parent
val typeParameterContainer = when (parent) {
is IrClass -> parent
is IrSimpleFunction -> parent.correspondingPropertySymbol?.owner ?: parent
is IrConstructor -> parent
else -> error("unknown type parameter container type")
}
typeParameterContainer.descriptor.name.asString()
} else descriptor.name.toString()
val uniqId = discoverableDescriptorsDeclaration?.let { declarationTable.uniqIdByDeclaration(it) }
val proto = ProtoDescriptorReference.newBuilder()
.addAllPackageFqName(serializeFqName(packageFqName))
.addAllClassFqName(serializeFqName(classFqName))
.setName(serializeString(nameString))
val flags = DescriptorReferenceFlags.IS_FAKE_OVERRIDE.encode(isFakeOverride) or
DescriptorReferenceFlags.IS_BACKING_FIELD.encode(isBackingField) or
DescriptorReferenceFlags.IS_GETTER.encode(declaration.isGetter) or
DescriptorReferenceFlags.IS_SETTER.encode(declaration.isSetter) or
DescriptorReferenceFlags.IS_DEFAULT_CONSTRUCTOR.encode(isDefaultConstructor) or
DescriptorReferenceFlags.IS_ENUM_ENTRY.encode(isEnumEntry) or
DescriptorReferenceFlags.IS_ENUM_SPECIAL.encode(isEnumSpecial) or
DescriptorReferenceFlags.IS_TYPE_PARAMETER.encode(isTypeParameter) or
DescriptorReferenceFlags.IS_EXPECT.encode(!skipExpects && declaration.isProperExpect)
proto.flags = flags
if (uniqId != null) proto.uniqIdIndex = uniqId.index
return proto.build()
}
}
@@ -1,33 +0,0 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.backend.common.serialization
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.library.metadata.KlibMetadataProtoBuf
import org.jetbrains.kotlin.protobuf.GeneratedMessageLite
import org.jetbrains.kotlin.serialization.deserialization.descriptors.*
fun <T, M : GeneratedMessageLite.ExtendableMessage<M>> M.tryGetExtension(extension: GeneratedMessageLite.GeneratedExtension<M, T>) =
if (this.hasExtension(extension)) this.getExtension<T>(extension) else null
interface DescriptorUniqIdAware {
fun DeclarationDescriptor.getUniqId(): Long?
}
object DeserializedDescriptorUniqIdAware : DescriptorUniqIdAware {
override fun DeclarationDescriptor.getUniqId(): Long? = when (this) {
is DeserializedClassDescriptor -> this.classProto.tryGetExtension(KlibMetadataProtoBuf.classUniqId)
is DeserializedSimpleFunctionDescriptor -> this.proto.tryGetExtension(KlibMetadataProtoBuf.functionUniqId)
is DeserializedPropertyDescriptor -> this.proto.tryGetExtension(KlibMetadataProtoBuf.propertyUniqId)
is DeserializedClassConstructorDescriptor -> this.proto.tryGetExtension(KlibMetadataProtoBuf.constructorUniqId)
is DeserializedTypeParameterDescriptor -> this.proto.tryGetExtension(KlibMetadataProtoBuf.typeParamUniqId)
is DeserializedTypeAliasDescriptor -> this.proto.tryGetExtension(KlibMetadataProtoBuf.typeAliasUniqId)
else -> null
}?.index
}
fun newDescriptorUniqId(index: Long): KlibMetadataProtoBuf.DescriptorUniqId =
KlibMetadataProtoBuf.DescriptorUniqId.newBuilder().setIndex(index).build()
@@ -5,29 +5,29 @@
package org.jetbrains.kotlin.backend.common.serialization.encodings
import org.jetbrains.kotlin.backend.common.serialization.IrFlags
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.descriptors.Visibility
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.Flags
import org.jetbrains.kotlin.serialization.deserialization.ProtoEnumFlags
import org.jetbrains.kotlin.types.Variance
inline class ClassFlags(val flags: Long) {
val modality: Modality get() = ProtoEnumFlags.modality(Flags.MODALITY.get(flags.toInt()))
val visibility: Visibility get() = ProtoEnumFlags.visibility(Flags.VISIBILITY.get(flags.toInt()))
val kind: ClassKind get() = ProtoEnumFlags.classKind(Flags.CLASS_KIND.get(flags.toInt()))
val modality: Modality get() = ProtoEnumFlags.modality(IrFlags.MODALITY.get(flags.toInt()))
val visibility: Visibility get() = ProtoEnumFlags.visibility(IrFlags.VISIBILITY.get(flags.toInt()))
val kind: ClassKind get() = ProtoEnumFlags.classKind(IrFlags.CLASS_KIND.get(flags.toInt()))
val isCompanion: Boolean get() = Flags.CLASS_KIND.get(flags.toInt()) == ProtoBuf.Class.Kind.COMPANION_OBJECT
val isInner: Boolean get() = Flags.IS_INNER.get(flags.toInt())
val isData: Boolean get() = Flags.IS_DATA.get(flags.toInt())
val isInline: Boolean get() = Flags.IS_INLINE_CLASS.get(flags.toInt())
val isExpect: Boolean get() = Flags.IS_EXPECT_CLASS.get(flags.toInt())
val isExternal: Boolean get() = Flags.IS_EXTERNAL_CLASS.get(flags.toInt())
val isFun: Boolean get() = Flags.IS_FUN_INTERFACE.get(flags.toInt())
val isCompanion: Boolean get() = IrFlags.CLASS_KIND.get(flags.toInt()) == ProtoBuf.Class.Kind.COMPANION_OBJECT
val isInner: Boolean get() = IrFlags.IS_INNER.get(flags.toInt())
val isData: Boolean get() = IrFlags.IS_DATA.get(flags.toInt())
val isInline: Boolean get() = IrFlags.IS_INLINE_CLASS.get(flags.toInt())
val isExpect: Boolean get() = IrFlags.IS_EXPECT_CLASS.get(flags.toInt())
val isExternal: Boolean get() = IrFlags.IS_EXTERNAL_CLASS.get(flags.toInt())
val isFun: Boolean get() = IrFlags.IS_FUN_INTERFACE.get(flags.toInt())
companion object {
fun encode(clazz: IrClass): Long {
@@ -38,7 +38,7 @@ inline class ClassFlags(val flags: Long) {
val kind = ProtoEnumFlags.classKind(kind, isCompanion)
val flags =
Flags.getClassFlags(hasAnnotation, visibility, modality, kind, isInner, isData, isExternal, isExpect, isInline, isFun)
IrFlags.getClassFlags(hasAnnotation, visibility, modality, kind, isInner, isData, isExternal, isExpect, isInline, isFun)
flags.toLong()
}
@@ -50,20 +50,20 @@ inline class ClassFlags(val flags: Long) {
inline class FunctionFlags(val flags: Long) {
val modality: Modality get() = ProtoEnumFlags.modality(Flags.MODALITY.get(flags.toInt()))
val visibility: Visibility get() = ProtoEnumFlags.visibility(Flags.VISIBILITY.get(flags.toInt()))
val modality: Modality get() = ProtoEnumFlags.modality(IrFlags.MODALITY.get(flags.toInt()))
val visibility: Visibility get() = ProtoEnumFlags.visibility(IrFlags.VISIBILITY.get(flags.toInt()))
val isOperator: Boolean get() = Flags.IS_OPERATOR.get(flags.toInt())
val isInline: Boolean get() = Flags.IS_INLINE.get(flags.toInt())
val isTailrec: Boolean get() = Flags.IS_TAILREC.get(flags.toInt())
val isExternal: Boolean get() = Flags.IS_EXTERNAL_FUNCTION.get(flags.toInt())
val isSuspend: Boolean get() = Flags.IS_SUSPEND.get(flags.toInt())
val isExpect: Boolean get() = Flags.IS_EXPECT_FUNCTION.get(flags.toInt())
val isOperator: Boolean get() = IrFlags.IS_OPERATOR.get(flags.toInt())
val isInline: Boolean get() = IrFlags.IS_INLINE.get(flags.toInt())
val isTailrec: Boolean get() = IrFlags.IS_TAILREC.get(flags.toInt())
val isExternal: Boolean get() = IrFlags.IS_EXTERNAL_FUNCTION.get(flags.toInt())
val isSuspend: Boolean get() = IrFlags.IS_SUSPEND.get(flags.toInt())
val isExpect: Boolean get() = IrFlags.IS_EXPECT_FUNCTION.get(flags.toInt())
val isFakeOverride: Boolean get() = kind() == CallableMemberDescriptor.Kind.FAKE_OVERRIDE
val isPrimary: Boolean get() = Flags.IS_PRIMARY.get(flags.toInt())
val isPrimary: Boolean get() = IrFlags.IS_PRIMARY.get(flags.toInt())
private fun kind(): CallableMemberDescriptor.Kind = ProtoEnumFlags.memberKind(Flags.MEMBER_KIND.get(flags.toInt()))
private fun kind(): CallableMemberDescriptor.Kind = ProtoEnumFlags.memberKind(IrFlags.MEMBER_KIND.get(flags.toInt()))
companion object {
fun encode(function: IrSimpleFunction): Long {
@@ -74,7 +74,7 @@ inline class FunctionFlags(val flags: Long) {
val kind = if (isFakeOverride) ProtoBuf.MemberKind.FAKE_OVERRIDE else ProtoBuf.MemberKind.DECLARATION
val flags = Flags.getFunctionFlags(
val flags = IrFlags.getFunctionFlags(
hasAnnotation, visibility, modality, kind,
isOperator, false, isInline, isTailrec, isExternal, isSuspend, isExpect
)
@@ -87,7 +87,7 @@ inline class FunctionFlags(val flags: Long) {
constructor.run {
val hasAnnotation = annotations.isNotEmpty()
val visibility = ProtoEnumFlags.visibility(visibility)
val flags = Flags.getConstructorFlags(hasAnnotation, visibility, isInline, isExternal, isExpect, isPrimary)
val flags = IrFlags.getConstructorFlags(hasAnnotation, visibility, isInline, isExternal, isExpect, isPrimary)
return flags.toLong()
}
@@ -99,18 +99,18 @@ inline class FunctionFlags(val flags: Long) {
inline class PropertyFlags(val flags: Long) {
val modality: Modality get() = ProtoEnumFlags.modality(Flags.MODALITY.get(flags.toInt()))
val visibility: Visibility get() = ProtoEnumFlags.visibility(Flags.VISIBILITY.get(flags.toInt()))
val modality: Modality get() = ProtoEnumFlags.modality(IrFlags.MODALITY.get(flags.toInt()))
val visibility: Visibility get() = ProtoEnumFlags.visibility(IrFlags.VISIBILITY.get(flags.toInt()))
val isVar: Boolean get() = Flags.IS_VAR.get(flags.toInt())
val isConst: Boolean get() = Flags.IS_CONST.get(flags.toInt())
val isLateinit: Boolean get() = Flags.IS_LATEINIT.get(flags.toInt())
val isExternal: Boolean get() = Flags.IS_EXTERNAL_PROPERTY.get(flags.toInt())
val isDelegated: Boolean get() = Flags.IS_DELEGATED.get(flags.toInt())
val isExpect: Boolean get() = Flags.IS_EXPECT_PROPERTY.get(flags.toInt())
val isVar: Boolean get() = IrFlags.IS_VAR.get(flags.toInt())
val isConst: Boolean get() = IrFlags.IS_CONST.get(flags.toInt())
val isLateinit: Boolean get() = IrFlags.IS_LATEINIT.get(flags.toInt())
val isExternal: Boolean get() = IrFlags.IS_EXTERNAL_PROPERTY.get(flags.toInt())
val isDelegated: Boolean get() = IrFlags.IS_DELEGATED.get(flags.toInt())
val isExpect: Boolean get() = IrFlags.IS_EXPECT_PROPERTY.get(flags.toInt())
val isFakeOverride: Boolean get() = kind() == CallableMemberDescriptor.Kind.FAKE_OVERRIDE
private fun kind(): CallableMemberDescriptor.Kind = ProtoEnumFlags.memberKind(Flags.MEMBER_KIND.get(flags.toInt()))
private fun kind(): CallableMemberDescriptor.Kind = ProtoEnumFlags.memberKind(IrFlags.MEMBER_KIND.get(flags.toInt()))
companion object {
fun encode(property: IrProperty): Long {
@@ -122,7 +122,7 @@ inline class PropertyFlags(val flags: Long) {
val hasGetter = getter != null
val hasSetter = setter != null
val flags = Flags.getPropertyFlags(
val flags = IrFlags.getPropertyFlags(
hasAnnotation, visibility, modality, kind,
isVar, hasGetter, hasSetter, false, isConst, isLateinit, isExternal, isDelegated, isExpect
)
@@ -137,13 +137,13 @@ inline class PropertyFlags(val flags: Long) {
inline class ValueParameterFlags(val flags: Long) {
val isCrossInline: Boolean get() = Flags.IS_CROSSINLINE.get(flags.toInt())
val isNoInline: Boolean get() = Flags.IS_NOINLINE.get(flags.toInt())
val isCrossInline: Boolean get() = IrFlags.IS_CROSSINLINE.get(flags.toInt())
val isNoInline: Boolean get() = IrFlags.IS_NOINLINE.get(flags.toInt())
companion object {
fun encode(param: IrValueParameter): Long {
return param.run {
Flags.getValueParameterFlags(annotations.isNotEmpty(), defaultValue != null, isCrossinline, isNoinline).toLong()
IrFlags.getValueParameterFlags(annotations.isNotEmpty(), defaultValue != null, isCrossinline, isNoinline).toLong()
}
}
@@ -153,14 +153,14 @@ inline class ValueParameterFlags(val flags: Long) {
inline class TypeAliasFlags(val flags: Long) {
val visibility: Visibility get() = ProtoEnumFlags.visibility(Flags.VISIBILITY.get(flags.toInt()))
val isActual: Boolean get() = Flags.IS_ACTUAL.get(flags.toInt())
val visibility: Visibility get() = ProtoEnumFlags.visibility(IrFlags.VISIBILITY.get(flags.toInt()))
val isActual: Boolean get() = IrFlags.IS_ACTUAL.get(flags.toInt())
companion object {
fun encode(typeAlias: IrTypeAlias): Long {
return typeAlias.run {
val visibility = ProtoEnumFlags.visibility(visibility)
Flags.getTypeAliasFlags(annotations.isNotEmpty(), visibility, isActual).toLong()
IrFlags.getTypeAliasFlags(annotations.isNotEmpty(), visibility, isActual).toLong()
}
}
@@ -170,14 +170,14 @@ inline class TypeAliasFlags(val flags: Long) {
inline class TypeParameterFlags(val flags: Long) {
val variance: Variance get() = ProtoEnumFlags.variance(Flags.VARIANCE.get(flags.toInt()))
val isReified: Boolean get() = Flags.IS_REIFIED.get(flags.toInt())
val variance: Variance get() = ProtoEnumFlags.variance(IrFlags.VARIANCE.get(flags.toInt()))
val isReified: Boolean get() = IrFlags.IS_REIFIED.get(flags.toInt())
companion object {
fun encode(typeParameter: IrTypeParameter): Long {
return typeParameter.run {
val variance = ProtoEnumFlags.variance(variance)
Flags.getTypeParameterFlags(annotations.isNotEmpty(), variance, isReified).toLong()
IrFlags.getTypeParameterFlags(annotations.isNotEmpty(), variance, isReified).toLong()
}
}
@@ -187,17 +187,17 @@ inline class TypeParameterFlags(val flags: Long) {
inline class FieldFlags(val flags: Long) {
val visibility: Visibility get() = ProtoEnumFlags.visibility(Flags.VISIBILITY.get(flags.toInt()))
val isFinal: Boolean get() = Flags.IS_FINAL.get(flags.toInt())
val isExternal: Boolean get() = Flags.IS_EXTERNAL_FIELD.get(flags.toInt())
val isStatic: Boolean get() = Flags.IS_STATIC.get(flags.toInt())
val isFakeOverride: Boolean get() = Flags.IS_FAKE_OVERRIDE.get(flags.toInt())
val visibility: Visibility get() = ProtoEnumFlags.visibility(IrFlags.VISIBILITY.get(flags.toInt()))
val isFinal: Boolean get() = IrFlags.IS_FINAL.get(flags.toInt())
val isExternal: Boolean get() = IrFlags.IS_EXTERNAL_FIELD.get(flags.toInt())
val isStatic: Boolean get() = IrFlags.IS_STATIC.get(flags.toInt())
val isFakeOverride: Boolean get() = IrFlags.IS_FAKE_OVERRIDE.get(flags.toInt())
companion object {
fun encode(field: IrField): Long {
return field.run {
val visibility = ProtoEnumFlags.visibility(visibility)
Flags.getFieldFlags(annotations.isNotEmpty(), visibility, isFinal, isExternal, isStatic, isFakeOverride).toLong()
IrFlags.getFieldFlags(annotations.isNotEmpty(), visibility, isFinal, isExternal, isStatic, isFakeOverride).toLong()
}
}
@@ -207,20 +207,20 @@ inline class FieldFlags(val flags: Long) {
inline class LocalVariableFlags(val flags: Long) {
val isVar: Boolean get() = Flags.IS_LOCAL_VAR.get(flags.toInt())
val isConst: Boolean get() = Flags.IS_LOCAL_CONST.get(flags.toInt())
val isLateinit: Boolean get() = Flags.IS_LOCAL_LATEINIT.get(flags.toInt())
val isVar: Boolean get() = IrFlags.IS_LOCAL_VAR.get(flags.toInt())
val isConst: Boolean get() = IrFlags.IS_LOCAL_CONST.get(flags.toInt())
val isLateinit: Boolean get() = IrFlags.IS_LOCAL_LATEINIT.get(flags.toInt())
companion object {
fun encode(variable: IrVariable): Long {
return variable.run {
Flags.getLocalFlags(annotations.isNotEmpty(), isVar, isConst, isLateinit).toLong()
IrFlags.getLocalFlags(annotations.isNotEmpty(), isVar, isConst, isLateinit).toLong()
}
}
fun encode(delegate: IrLocalDelegatedProperty): Long {
return delegate.run {
Flags.getLocalFlags(annotations.isNotEmpty(), isVar, false, false).toLong()
IrFlags.getLocalFlags(annotations.isNotEmpty(), isVar, false, false).toLong()
}
}
@@ -5,6 +5,12 @@
package org.jetbrains.kotlin.backend.common.serialization.encodings
/**
* The idea of encoding is is mixing bits of 2 int values between each other to benefit VLQ encoding in proto.
* i = i1.i2.i3.i4
* j = j1.j2.j3.j4
* ij -> i1.j1.i2.j2.i3.j3.i4.j4
*/
inline class BinaryLattice(private val code: Long) {
val first: Int get() = decodeInt(code)
@@ -11,6 +11,6 @@ import org.jetbrains.kotlin.ir.util.KotlinMangler
abstract class AbstractKotlinMangler<D : Any> : KotlinMangler<D> {
override val String.hashMangle get() = cityHash64()
protected abstract fun getExportChecker(): KotlinExportChecker<D>
protected abstract fun getMangleComputer(prefix: String): KotlinMangleComputer<D>
abstract fun getExportChecker(): KotlinExportChecker<D>
abstract fun getMangleComputer(mode: MangleMode): KotlinMangleComputer<D>
}
@@ -6,5 +6,8 @@
package org.jetbrains.kotlin.backend.common.serialization.mangle
interface KotlinMangleComputer<D : Any> {
fun computeMangle(declaration: D): String
fun copy(newMode: MangleMode): KotlinMangleComputer<D>
}
@@ -19,6 +19,7 @@ enum class MangleConstant(val prefix: Char, val separator: Char, val suffix: Cha
const val EXPECT_MARK = "#expect"
const val UNKNOWN_MARK = "<unknown>"
const val DYNAMIC_MARK = "<dynamic>"
const val STATIC_MEMBER_MARK = "#static"
const val VARIANCE_SEPARATOR = '|'
const val UPPER_BOUND_SEPARATOR = '§'
@@ -33,6 +34,8 @@ enum class MangleConstant(val prefix: Char, val separator: Char, val suffix: Cha
const val FUNCTION_NAME_PREFIX = '#'
const val TYPE_PARAM_INDEX_PREFIX = '@'
const val JAVA_FIELD_SUFFIX = "#jf"
const val EMPTY_PREFIX = ""
const val FUN_PREFIX = "kfun"
@@ -0,0 +1,12 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.backend.common.serialization.mangle
enum class MangleMode(val signature: Boolean, val fqn: Boolean) {
SIGNATURE(true, false),
FQNAME(false, true),
FULL(true, true)
}
@@ -22,6 +22,8 @@ class ManglerChecker(vararg _manglers: KotlinMangler<IrDeclaration>) : IrElement
private fun KotlinMangler<IrDeclaration>.isExportCheck(declaration: IrDeclaration) = declaration.isExported()
private fun KotlinMangler<IrDeclaration>.stringMangle(declaration: IrDeclaration) = declaration.mangleString
private fun KotlinMangler<IrDeclaration>.signatureMangle(declaration: IrDeclaration) = declaration.signatureString
private fun KotlinMangler<IrDeclaration>.fqnMangle(declaration: IrDeclaration) = declaration.fqnString
private fun <T : Any, R> Iterable<T>.checkAllEqual(init: R, op: T.() -> R, onError: (T, R, T, R) -> Unit): R {
var prev: T? = null
@@ -48,15 +50,21 @@ class ManglerChecker(vararg _manglers: KotlinMangler<IrDeclaration>) : IrElement
override fun visitDeclaration(declaration: IrDeclaration) {
val exported = manglers.checkAllEqual(false, { isExportCheck(declaration) }) { m1, r1, m2, r2 ->
println("${declaration.render()}\n ${m1.manglerName}: $r1\n ${m2.manglerName}: $r2\n")
error("${declaration.render()}\n ${m1.manglerName}: $r1\n ${m2.manglerName}: $r2\n")
}
if (!exported) return
manglers.checkAllEqual("", { stringMangle(declaration) }) { m1, r1, m2, r2 ->
println("${declaration.render()}\n ${m1.manglerName}: $r1\n ${m2.manglerName}: $r2\n")
error("${declaration.render()}\n ${m1.manglerName}: $r1\n ${m2.manglerName}: $r2\n")
error("FULL: ${declaration.render()}\n ${m1.manglerName}: $r1\n ${m2.manglerName}: $r2\n")
}
manglers.checkAllEqual("", { signatureMangle(declaration) }) { m1, r1, m2, r2 ->
error("SIG: ${declaration.render()}\n ${m1.manglerName}: $r1\n ${m2.manglerName}: $r2\n")
}
manglers.checkAllEqual("", { fqnMangle(declaration) }) { m1, r1, m2, r2 ->
error("FQN: ${declaration.render()}\n ${m1.manglerName}: $r1\n ${m2.manglerName}: $r2\n")
}
declaration.acceptChildrenVoid(this)
@@ -5,10 +5,7 @@
package org.jetbrains.kotlin.backend.common.serialization.mangle.descriptor
import org.jetbrains.kotlin.backend.common.serialization.mangle.AbstractKotlinMangler
import org.jetbrains.kotlin.backend.common.serialization.mangle.KotlinMangleComputer
import org.jetbrains.kotlin.backend.common.serialization.mangle.MangleConstant
import org.jetbrains.kotlin.backend.common.serialization.mangle.SpecialDeclarationType
import org.jetbrains.kotlin.backend.common.serialization.mangle.*
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
@@ -19,10 +16,10 @@ import org.jetbrains.kotlin.ir.declarations.IrField
import org.jetbrains.kotlin.ir.util.KotlinMangler
abstract class DescriptorBasedKotlinManglerImpl : AbstractKotlinMangler<DeclarationDescriptor>(), KotlinMangler.DescriptorMangler {
private fun withPrefix(prefix: String, descriptor: DeclarationDescriptor): String =
getMangleComputer(prefix).computeMangle(descriptor)
private fun withMode(mode: MangleMode, descriptor: DeclarationDescriptor): String =
getMangleComputer(mode).computeMangle(descriptor)
override fun ClassDescriptor.mangleEnumEntryString(): String = withPrefix(MangleConstant.ENUM_ENTRY_PREFIX, this)
override fun ClassDescriptor.mangleEnumEntryString(): String = withMode(MangleMode.FQNAME, this)
override fun ClassDescriptor.isExportEnumEntry(): Boolean =
getExportChecker().check(this, SpecialDeclarationType.ENUM_ENTRY)
@@ -32,7 +29,13 @@ abstract class DescriptorBasedKotlinManglerImpl : AbstractKotlinMangler<Declarat
override fun PropertyDescriptor.mangleFieldString(): String = error("Fields supposed to be non-exporting")
override val DeclarationDescriptor.mangleString: String
get() = withPrefix(MangleConstant.EMPTY_PREFIX, this)
get() = withMode(MangleMode.FULL, this)
override val DeclarationDescriptor.signatureString: String
get() = withMode(MangleMode.SIGNATURE, this)
override val DeclarationDescriptor.fqnString: String
get() = withMode(MangleMode.FQNAME, this)
override fun DeclarationDescriptor.isExported(): Boolean = getExportChecker().check(this, SpecialDeclarationType.REGULAR)
}
@@ -60,7 +63,13 @@ class Ir2DescriptorManglerAdapter(private val delegate: DescriptorBasedKotlinMan
}
}
override val IrDeclaration.signatureString: String
get() = delegate.run { descriptor.signatureString }
override val IrDeclaration.fqnString: String
get() = delegate.run { descriptor.fqnString }
override fun getExportChecker() = error("Should not have been reached")
override fun getMangleComputer(prefix: String): KotlinMangleComputer<IrDeclaration> = error("Should not have been reached")
override fun getMangleComputer(mode: MangleMode): KotlinMangleComputer<IrDeclaration> = error("Should not have been reached")
}
@@ -26,10 +26,10 @@ abstract class DescriptorExportCheckerVisitor : DeclarationDescriptorVisitor<Boo
private fun Visibility.isPubliclyVisible(): Boolean = isPublicAPI || this === Visibilities.INTERNAL
private fun DeclarationDescriptorNonRoot.isExported(annotations: Annotations, visibility: Visibility?): Boolean {
if (annotations.hasAnnotation(publishedApiAnnotation)) return true
if (visibility != null && !visibility.isPubliclyVisible()) return false
val speciallyExported = annotations.hasAnnotation(publishedApiAnnotation) || isPlatformSpecificExported()
val selfExported = speciallyExported || visibility == null || visibility.isPubliclyVisible()
return containingDeclaration.accept(this@DescriptorExportCheckerVisitor, SpecialDeclarationType.REGULAR) ?: false
return selfExported && containingDeclaration.accept(this@DescriptorExportCheckerVisitor, SpecialDeclarationType.REGULAR) ?: false
}
override fun visitPackageFragmentDescriptor(descriptor: PackageFragmentDescriptor, data: SpecialDeclarationType) = true
@@ -66,9 +66,7 @@ abstract class DescriptorExportCheckerVisitor : DeclarationDescriptorVisitor<Boo
else constructorDescriptor.run { isExported(annotations, visibility) }
}
override fun visitScriptDescriptor(scriptDescriptor: ScriptDescriptor, data: SpecialDeclarationType): Boolean {
reportUnexpectedDescriptor(scriptDescriptor)
}
override fun visitScriptDescriptor(scriptDescriptor: ScriptDescriptor, data: SpecialDeclarationType): Boolean = false
override fun visitPropertyDescriptor(descriptor: PropertyDescriptor, data: SpecialDeclarationType): Boolean {
val visibility = if (data == SpecialDeclarationType.BACKING_FIELD) {
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.backend.common.serialization.mangle.descriptor
import org.jetbrains.kotlin.backend.common.serialization.mangle.KotlinMangleComputer
import org.jetbrains.kotlin.backend.common.serialization.mangle.MangleConstant
import org.jetbrains.kotlin.backend.common.serialization.mangle.MangleMode
import org.jetbrains.kotlin.backend.common.serialization.mangle.collect
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.resolve.descriptorUtil.module
@@ -14,7 +15,7 @@ import org.jetbrains.kotlin.types.*
import org.jetbrains.kotlin.types.typeUtil.isUnit
import org.jetbrains.kotlin.utils.addToStdlib.ifNotEmpty
abstract class DescriptorMangleComputer(protected val builder: StringBuilder, protected val specialPrefix: String) :
abstract class DescriptorMangleComputer(protected val builder: StringBuilder, private val mode: MangleMode) :
DeclarationDescriptorVisitor<Unit, Boolean>, KotlinMangleComputer<DeclarationDescriptor> {
override fun computeMangle(declaration: DeclarationDescriptor): String {
@@ -22,75 +23,106 @@ abstract class DescriptorMangleComputer(protected val builder: StringBuilder, pr
return builder.toString()
}
protected abstract fun copy(): DescriptorMangleComputer
abstract override fun copy(newMode: MangleMode): DescriptorMangleComputer
private fun StringBuilder.appendName(s: String) {
if (mode.fqn) {
append(s)
}
}
private fun StringBuilder.appendName(c: Char) {
if (mode.fqn) {
append(c)
}
}
private fun StringBuilder.appendSignature(s: String) {
if (mode.signature) {
append(s)
}
}
private fun StringBuilder.appendSignature(c: Char) {
if (mode.signature) {
append(c)
}
}
private fun StringBuilder.appendSignature(i: Int) {
if (mode.signature) {
append(i)
}
}
private val typeParameterContainer = ArrayList<DeclarationDescriptor>(4)
private var isRealExpect = false
private fun addPrefix(prefix: String, addPrefix: Boolean): Int {
if (addPrefix) {
builder.append(prefix)
builder.append(MangleConstant.PREFIX_SEPARATOR)
}
return builder.length
}
private fun DeclarationDescriptor.mangleSimpleDeclaration(prefix: String, addPrefix: Boolean, name: String) {
val prefixLength = addPrefix(prefix, addPrefix)
private fun DeclarationDescriptor.mangleSimpleDeclaration(name: String) {
val l = builder.length
containingDeclaration?.accept(this@DescriptorMangleComputer, false)
if (prefixLength != builder.length) builder.append(MangleConstant.FQN_SEPARATOR)
if (builder.length != l) builder.appendName(MangleConstant.FQN_SEPARATOR)
builder.append(name)
builder.appendName(name)
}
open val FunctionDescriptor.platformSpecificFunctionName: String? get() = null
open fun FunctionDescriptor.platformSpecificFunctionName(): String? = null
private fun reportUnexpectedDescriptor(descriptor: DeclarationDescriptor) {
error("unexpected descriptor $descriptor")
}
open fun FunctionDescriptor.platformSpecificSuffix(): String? = null
open fun PropertyDescriptor.platformSpecificSuffix(): String? = null
private fun FunctionDescriptor.mangleFunction(isCtor: Boolean, prefix: Boolean, container: CallableDescriptor) {
open fun FunctionDescriptor.specialValueParamPrefix(param: ValueParameterDescriptor): String = ""
private val CallableDescriptor.isRealStatic: Boolean
get() = dispatchReceiverParameter == null && containingDeclaration !is PackageFragmentDescriptor
private fun FunctionDescriptor.mangleFunction(isCtor: Boolean, container: CallableDescriptor) {
isRealExpect = isRealExpect or isExpect
val prefixLength = addPrefix(MangleConstant.FUN_PREFIX, prefix)
typeParameterContainer.add(container)
container.containingDeclaration.accept(this@DescriptorMangleComputer, false)
if (prefixLength != builder.length) builder.append(MangleConstant.FQN_SEPARATOR)
builder.appendName(MangleConstant.FUNCTION_NAME_PREFIX)
builder.append(MangleConstant.FUNCTION_NAME_PREFIX)
platformSpecificFunctionName()?.let {
builder.append(it)
return
}
if (visibility != Visibilities.INTERNAL) builder.append(name)
else {
builder.append(name)
builder.append(name.asString())
if (visibility == Visibilities.INTERNAL) {
builder.append(MangleConstant.MODULE_SEPARATOR)
builder.append(module.name.asString().run { substring(1, lastIndex) })
}
mangleSignature(isCtor, container)
platformSpecificSuffix()?.let {
builder.append(MangleConstant.PLATFORM_FUNCTION_MARKER)
builder.append(it)
}
if (prefix && isRealExpect) builder.append(MangleConstant.EXPECT_MARK)
}
private fun FunctionDescriptor.mangleSignature(isCtor: Boolean, realTypeParameterContainer: CallableDescriptor) {
if (!mode.signature) return
if (!isCtor && realTypeParameterContainer.isRealStatic) {
builder.appendSignature(MangleConstant.STATIC_MEMBER_MARK)
}
extensionReceiverParameter?.let {
builder.append(MangleConstant.EXTENSION_RECEIVER_PREFIX)
builder.appendSignature(MangleConstant.EXTENSION_RECEIVER_PREFIX)
mangleExtensionReceiverParameter(builder, it)
}
valueParameters.collect(builder, MangleConstant.VALUE_PARAMETERS) { mangleValueParameter(this, it) }
valueParameters.collect(builder, MangleConstant.VALUE_PARAMETERS) {
appendSignature(specialValueParamPrefix(it))
mangleValueParameter(this, it)
}
realTypeParameterContainer.typeParameters.filter { it.containingDeclaration == realTypeParameterContainer }
.collect(builder, MangleConstant.TYPE_PARAMETERS) { mangleTypeParameter(this, it) }
@@ -99,6 +131,11 @@ abstract class DescriptorMangleComputer(protected val builder: StringBuilder, pr
mangleType(builder, this)
}
}
platformSpecificSuffix()?.let {
builder.appendSignature(MangleConstant.PLATFORM_FUNCTION_MARKER)
builder.appendSignature(it)
}
}
private fun mangleExtensionReceiverParameter(vpBuilder: StringBuilder, param: ReceiverParameterDescriptor) {
@@ -108,12 +145,12 @@ abstract class DescriptorMangleComputer(protected val builder: StringBuilder, pr
private fun mangleValueParameter(vpBuilder: StringBuilder, param: ValueParameterDescriptor) {
mangleType(vpBuilder, param.type)
if (param.varargElementType != null) vpBuilder.append(MangleConstant.VAR_ARG_MARK)
if (param.varargElementType != null) vpBuilder.appendSignature(MangleConstant.VAR_ARG_MARK)
}
private fun mangleTypeParameter(tpBuilder: StringBuilder, param: TypeParameterDescriptor) {
tpBuilder.append(param.index)
tpBuilder.append(MangleConstant.UPPER_BOUND_SEPARATOR)
tpBuilder.appendSignature(param.index)
tpBuilder.appendSignature(MangleConstant.UPPER_BOUND_SEPARATOR)
param.upperBounds.collect(tpBuilder, MangleConstant.UPPER_BOUNDS) { mangleType(this, it) }
}
@@ -121,20 +158,32 @@ abstract class DescriptorMangleComputer(protected val builder: StringBuilder, pr
private fun mangleType(tBuilder: StringBuilder, wtype: KotlinType) {
when (val type = wtype.unwrap()) {
is SimpleType -> {
when (val classifier = type.constructor.declarationDescriptor) {
is ClassDescriptor -> classifier.accept(copy(), false)
is TypeParameterDescriptor -> tBuilder.mangleTypeParameterReference(classifier)
else -> error("Unexpected classifier: $classifier")
if (type is SupposititiousSimpleType) {
val classId = type.overwrittenClass
classId.packageFqName.let {
if (!it.isRoot) {
builder.appendSignature(it.asString())
builder.appendSignature(MangleConstant.FQN_SEPARATOR)
}
builder.appendSignature(classId.relativeClassName.asString())
}
} else {
when (val classifier = type.constructor.declarationDescriptor) {
is ClassDescriptor -> classifier.accept(copy(MangleMode.FQNAME), false)
is TypeParameterDescriptor -> tBuilder.mangleTypeParameterReference(classifier)
else -> error("Unexpected classifier: $classifier")
}
}
type.arguments.ifNotEmpty {
collect(tBuilder, MangleConstant.TYPE_ARGUMENTS) { arg ->
if (arg.isStarProjection) {
append(MangleConstant.STAR_MARK)
appendSignature(MangleConstant.STAR_MARK)
} else {
if (arg.projectionKind != Variance.INVARIANT) {
append(arg.projectionKind.label)
append(MangleConstant.VARIANCE_SEPARATOR)
appendSignature(arg.projectionKind.label)
appendSignature(MangleConstant.VARIANCE_SEPARATOR)
}
mangleType(this, arg.type)
@@ -142,17 +191,17 @@ abstract class DescriptorMangleComputer(protected val builder: StringBuilder, pr
}
}
if (type.isMarkedNullable) tBuilder.append(MangleConstant.Q_MARK)
if (type.isMarkedNullable) tBuilder.appendSignature(MangleConstant.Q_MARK)
}
is DynamicType -> tBuilder.append(MangleConstant.DYNAMIC_MARK)
is DynamicType -> tBuilder.appendSignature(MangleConstant.DYNAMIC_MARK)
is FlexibleType -> {
// TODO: is that correct way to mangle flexible type?
with(MangleConstant.FLEXIBLE_TYPE) {
tBuilder.append(prefix)
tBuilder.appendSignature(prefix)
mangleType(tBuilder, type.lowerBound)
tBuilder.append(separator)
tBuilder.appendSignature(separator)
mangleType(tBuilder, type.upperBound)
tBuilder.append(suffix)
tBuilder.appendSignature(suffix)
}
}
else -> error("Unexpected type $wtype")
@@ -164,13 +213,13 @@ abstract class DescriptorMangleComputer(protected val builder: StringBuilder, pr
val ci = typeParameterContainer.indexOf(parent)
// TODO: what should we do in this case?
// require(ci >= 0) { "No type container found for ${typeParameter.render()}" }
append(ci)
append(MangleConstant.INDEX_SEPARATOR)
append(typeParameter.index)
appendSignature(ci)
appendSignature(MangleConstant.INDEX_SEPARATOR)
appendSignature(typeParameter.index)
}
override fun visitPackageFragmentDescriptor(descriptor: PackageFragmentDescriptor, data: Boolean) {
descriptor.fqName.let { if (!it.isRoot) builder.append(it.asString()) }
descriptor.fqName.let { if (!it.isRoot) builder.appendName(it.asString()) }
}
override fun visitPackageViewDescriptor(descriptor: PackageViewDescriptor, data: Boolean) = reportUnexpectedDescriptor(descriptor)
@@ -178,39 +227,30 @@ abstract class DescriptorMangleComputer(protected val builder: StringBuilder, pr
override fun visitVariableDescriptor(descriptor: VariableDescriptor, data: Boolean) = reportUnexpectedDescriptor(descriptor)
override fun visitFunctionDescriptor(descriptor: FunctionDescriptor, data: Boolean) {
descriptor.platformSpecificFunctionName?.let {
builder.append(it)
return
}
descriptor.mangleFunction(false, data, descriptor)
descriptor.mangleFunction(false, descriptor)
}
override fun visitTypeParameterDescriptor(descriptor: TypeParameterDescriptor, data: Boolean) {
addPrefix(MangleConstant.TYPE_PARAM_PREFIX, data)
descriptor.containingDeclaration.accept(this, data)
builder.append(MangleConstant.TYPE_PARAM_INDEX_PREFIX)
builder.append(descriptor.index)
builder.appendSignature(MangleConstant.TYPE_PARAM_INDEX_PREFIX)
builder.appendSignature(descriptor.index)
}
override fun visitClassDescriptor(descriptor: ClassDescriptor, data: Boolean) {
isRealExpect = isRealExpect or descriptor.isExpect
typeParameterContainer.add(descriptor)
val prefix = if (specialPrefix == MangleConstant.ENUM_ENTRY_PREFIX) specialPrefix else MangleConstant.CLASS_PREFIX
descriptor.mangleSimpleDeclaration(prefix, data, descriptor.name.asString())
if (data && isRealExpect) builder.append(MangleConstant.EXPECT_MARK)
descriptor.mangleSimpleDeclaration(descriptor.name.asString())
}
override fun visitTypeAliasDescriptor(descriptor: TypeAliasDescriptor, data: Boolean) {
descriptor.mangleSimpleDeclaration(MangleConstant.TYPE_ALIAS_PREFIX, data, descriptor.name.asString())
descriptor.mangleSimpleDeclaration(descriptor.name.asString())
}
override fun visitModuleDeclaration(descriptor: ModuleDescriptor, data: Boolean) = reportUnexpectedDescriptor(descriptor)
override fun visitConstructorDescriptor(constructorDescriptor: ConstructorDescriptor, data: Boolean) {
constructorDescriptor.mangleFunction(true, data, constructorDescriptor)
constructorDescriptor.mangleFunction(isCtor = true, container = constructorDescriptor)
}
override fun visitScriptDescriptor(scriptDescriptor: ScriptDescriptor, data: Boolean) = reportUnexpectedDescriptor(scriptDescriptor)
@@ -218,36 +258,42 @@ abstract class DescriptorMangleComputer(protected val builder: StringBuilder, pr
override fun visitPropertyDescriptor(descriptor: PropertyDescriptor, data: Boolean) {
val extensionReceiver = descriptor.extensionReceiverParameter
val prefix = if (specialPrefix == MangleConstant.FIELD_PREFIX) specialPrefix else MangleConstant.PROPERTY_PREFIX
val prefixLength = addPrefix(prefix, data)
isRealExpect = isRealExpect or descriptor.isExpect
typeParameterContainer.add(descriptor)
descriptor.containingDeclaration.accept(this, false)
if (prefixLength != builder.length) builder.append(MangleConstant.FQN_SEPARATOR)
if (descriptor.isRealStatic) {
builder.appendSignature(MangleConstant.STATIC_MEMBER_MARK)
}
if (extensionReceiver != null) {
builder.append(MangleConstant.EXTENSION_RECEIVER_PREFIX)
builder.appendSignature(MangleConstant.EXTENSION_RECEIVER_PREFIX)
mangleExtensionReceiverParameter(builder, extensionReceiver)
}
builder.append(descriptor.name)
if (data && isRealExpect) builder.append(MangleConstant.EXPECT_MARK)
descriptor.typeParameters.collect(builder, MangleConstant.TYPE_PARAMETERS) { mangleTypeParameter(this, it) }
builder.append(descriptor.name.asString())
descriptor.platformSpecificSuffix()?.let {
builder.appendSignature(it)
}
}
override fun visitValueParameterDescriptor(descriptor: ValueParameterDescriptor, data: Boolean) = reportUnexpectedDescriptor(descriptor)
private fun manglePropertyAccessor(accessor: PropertyAccessorDescriptor, data: Boolean) {
accessor.mangleFunction(false, data, accessor.correspondingProperty)
private fun manglePropertyAccessor(accessor: PropertyAccessorDescriptor) {
val property = accessor.correspondingProperty
accessor.mangleFunction(false, property)
}
override fun visitPropertyGetterDescriptor(descriptor: PropertyGetterDescriptor, data: Boolean) {
manglePropertyAccessor(descriptor, data)
manglePropertyAccessor(descriptor)
}
override fun visitPropertySetterDescriptor(descriptor: PropertySetterDescriptor, data: Boolean) {
manglePropertyAccessor(descriptor, data)
manglePropertyAccessor(descriptor)
}
override fun visitReceiverParameterDescriptor(descriptor: ReceiverParameterDescriptor, data: Boolean) =
@@ -6,13 +6,20 @@
package org.jetbrains.kotlin.backend.common.serialization.mangle.ir
import org.jetbrains.kotlin.backend.common.serialization.mangle.AbstractKotlinMangler
import org.jetbrains.kotlin.backend.common.serialization.mangle.MangleMode
import org.jetbrains.kotlin.backend.common.serialization.mangle.SpecialDeclarationType
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
import org.jetbrains.kotlin.ir.util.KotlinMangler
abstract class IrBasedKotlinManglerImpl : AbstractKotlinMangler<IrDeclaration>(), KotlinMangler.IrMangler {
override val IrDeclaration.mangleString: String
get() = getMangleComputer("").computeMangle(this)
get() = getMangleComputer(MangleMode.FULL).computeMangle(this)
override val IrDeclaration.signatureString: String
get() = getMangleComputer(MangleMode.SIGNATURE).computeMangle(this)
override val IrDeclaration.fqnString: String
get() = getMangleComputer(MangleMode.FQNAME).computeMangle(this)
override fun IrDeclaration.isExported(): Boolean = getExportChecker().check(this, SpecialDeclarationType.REGULAR)
}
@@ -28,10 +28,11 @@ abstract class IrExportCheckerVisitor : IrElementVisitor<Boolean, Nothing?>, Kot
abstract override fun IrDeclaration.isPlatformSpecificExported(): Boolean
private fun IrDeclaration.isExported(annotations: List<IrConstructorCall>, visibility: Visibility?): Boolean {
if (annotations.hasAnnotation(publishedApiAnnotation)) return true
if (visibility != null && !visibility.isPubliclyVisible()) return false
val speciallyExported = annotations.hasAnnotation(publishedApiAnnotation) || isPlatformSpecificExported()
return parent.accept(this@IrExportCheckerVisitor, null)
val selfExported = speciallyExported || visibility == null || visibility.isPubliclyVisible()
return selfExported && parent.accept(this@IrExportCheckerVisitor, null)
}
private fun Visibility.isPubliclyVisible(): Boolean = isPublicAPI || this === Visibilities.INTERNAL
@@ -5,8 +5,10 @@
package org.jetbrains.kotlin.backend.common.serialization.mangle.ir
import org.jetbrains.kotlin.backend.common.ir.isStatic
import org.jetbrains.kotlin.backend.common.serialization.mangle.KotlinMangleComputer
import org.jetbrains.kotlin.backend.common.serialization.mangle.MangleConstant
import org.jetbrains.kotlin.backend.common.serialization.mangle.MangleMode
import org.jetbrains.kotlin.backend.common.serialization.mangle.collect
import org.jetbrains.kotlin.descriptors.Visibilities
import org.jetbrains.kotlin.ir.IrElement
@@ -21,55 +23,80 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
import org.jetbrains.kotlin.types.Variance
import org.jetbrains.kotlin.utils.addToStdlib.ifNotEmpty
abstract class IrMangleComputer(protected val builder: StringBuilder) : IrElementVisitor<Unit, Boolean>,
KotlinMangleComputer<IrDeclaration> {
abstract class IrMangleComputer(protected val builder: StringBuilder, private val mode: MangleMode) :
IrElementVisitor<Unit, Boolean>, KotlinMangleComputer<IrDeclaration> {
private val typeParameterContainer = ArrayList<IrDeclaration>(4)
private var isRealExpect = false
open val IrFunction.platformSpecificFunctionName: String? get() = null
open fun IrFunction.platformSpecificFunctionName(): String? = null
protected abstract fun copy(): IrMangleComputer
open fun IrFunction.specialValueParamPrefix(param: IrValueParameter): String = ""
abstract override fun copy(newMode: MangleMode): IrMangleComputer
private fun StringBuilder.appendName(s: String) {
if (mode.fqn) {
append(s)
}
}
private fun StringBuilder.appendName(c: Char) {
if (mode.fqn) {
append(c)
}
}
private fun StringBuilder.appendSignature(s: String) {
if (mode.signature) {
append(s)
}
}
private fun StringBuilder.appendSignature(c: Char) {
if (mode.signature) {
append(c)
}
}
private fun StringBuilder.appendSignature(i: Int) {
if (mode.signature) {
append(i)
}
}
override fun computeMangle(declaration: IrDeclaration): String {
declaration.accept(this, true)
return builder.toString()
}
private fun addPrefix(prefix: String, addPrefix: Boolean): Int {
if (addPrefix) {
builder.append(prefix)
builder.append(MangleConstant.PREFIX_SEPARATOR)
}
return builder.length
}
private fun IrDeclaration.mangleSimpleDeclaration(prefix: String, addPrefix: Boolean, name: String) {
val prefixLength = addPrefix(prefix, addPrefix)
private fun IrDeclaration.mangleSimpleDeclaration(name: String) {
val l = builder.length
parent.accept(this@IrMangleComputer, false)
if (prefixLength != builder.length) builder.append(MangleConstant.FQN_SEPARATOR)
if (builder.length != l) builder.appendName(MangleConstant.FQN_SEPARATOR)
builder.append(name)
builder.appendName(name)
}
private fun IrFunction.mangleFunction(isCtor: Boolean, prefix: Boolean, container: IrDeclaration) {
private fun IrFunction.mangleFunction(isCtor: Boolean, isStatic: Boolean, container: IrDeclaration) {
isRealExpect = isRealExpect or isExpect
val prefixLength = addPrefix(MangleConstant.FUN_PREFIX, prefix)
typeParameterContainer.add(container)
container.parent.accept(this@IrMangleComputer, false)
if (prefixLength != builder.length) builder.append(MangleConstant.FQN_SEPARATOR)
builder.appendName(MangleConstant.FUNCTION_NAME_PREFIX)
builder.append(MangleConstant.FUNCTION_NAME_PREFIX)
platformSpecificFunctionName()?.let {
builder.append(it)
return
}
if (visibility != Visibilities.INTERNAL) builder.append(name)
else {
builder.append(name)
builder.append(name.asString())
if (visibility == Visibilities.INTERNAL) {
builder.append(MangleConstant.MODULE_SEPARATOR)
val moduleName = try {
module.name.asString().run { substring(1, lastIndex) }
@@ -79,19 +106,25 @@ abstract class IrMangleComputer(protected val builder: StringBuilder) : IrElemen
builder.append(moduleName)
}
mangleSignature(isCtor)
if (prefix && isRealExpect) builder.append(MangleConstant.EXPECT_MARK)
mangleSignature(isCtor, isStatic)
}
private fun IrFunction.mangleSignature(isCtor: Boolean) {
private fun IrFunction.mangleSignature(isCtor: Boolean, isStatic: Boolean) {
if (!mode.signature) return
if (isStatic) {
builder.appendSignature(MangleConstant.STATIC_MEMBER_MARK)
}
extensionReceiverParameter?.let {
builder.append(MangleConstant.EXTENSION_RECEIVER_PREFIX)
builder.appendSignature(MangleConstant.EXTENSION_RECEIVER_PREFIX)
mangleValueParameter(builder, it)
}
valueParameters.collect(builder, MangleConstant.VALUE_PARAMETERS) { mangleValueParameter(this, it) }
valueParameters.collect(builder, MangleConstant.VALUE_PARAMETERS) {
appendSignature(specialValueParamPrefix(it))
mangleValueParameter(this, it)
}
typeParameters.collect(builder, MangleConstant.TYPE_PARAMETERS) { mangleTypeParameter(this, it) }
if (!isCtor && !returnType.isUnit()) {
@@ -108,12 +141,12 @@ abstract class IrMangleComputer(protected val builder: StringBuilder) : IrElemen
private fun mangleValueParameter(vpBuilder: StringBuilder, param: IrValueParameter) {
mangleType(vpBuilder, param.type)
if (param.isVararg) vpBuilder.append(MangleConstant.VAR_ARG_MARK)
if (param.isVararg) vpBuilder.appendSignature(MangleConstant.VAR_ARG_MARK)
}
private fun mangleTypeParameter(tpBuilder: StringBuilder, param: IrTypeParameter) {
tpBuilder.append(param.index)
tpBuilder.append(MangleConstant.UPPER_BOUND_SEPARATOR)
tpBuilder.appendSignature(param.index)
tpBuilder.appendSignature(MangleConstant.UPPER_BOUND_SEPARATOR)
param.superTypes.collect(tpBuilder, MangleConstant.UPPER_BOUNDS) { mangleType(this, it) }
}
@@ -123,27 +156,27 @@ abstract class IrMangleComputer(protected val builder: StringBuilder) : IrElemen
val ci = typeParameterContainer.indexOf(parent)
// TODO: what should we do in this case?
// require(ci >= 0) { "No type container found for ${typeParameter.render()}" }
append(ci)
append(MangleConstant.INDEX_SEPARATOR)
append(typeParameter.index)
appendSignature(ci)
appendSignature(MangleConstant.INDEX_SEPARATOR)
appendSignature(typeParameter.index)
}
private fun mangleType(tBuilder: StringBuilder, type: IrType) {
when (type) {
is IrSimpleType -> {
when (val classifier = type.classifier) {
is IrClassSymbol -> classifier.owner.accept(copy(), false)
is IrClassSymbol -> classifier.owner.accept(copy(MangleMode.FQNAME), false)
is IrTypeParameterSymbol -> tBuilder.mangleTypeParameterReference(classifier.owner)
}
type.arguments.ifNotEmpty {
collect(tBuilder, MangleConstant.TYPE_ARGUMENTS) { arg ->
when (arg) {
is IrStarProjection -> append(MangleConstant.STAR_MARK)
is IrStarProjection -> appendSignature(MangleConstant.STAR_MARK)
is IrTypeProjection -> {
if (arg.variance != Variance.INVARIANT) {
append(arg.variance.label)
append(MangleConstant.VARIANCE_SEPARATOR)
appendSignature(arg.variance.label)
appendSignature(MangleConstant.VARIANCE_SEPARATOR)
}
mangleType(this, arg.type)
@@ -152,9 +185,9 @@ abstract class IrMangleComputer(protected val builder: StringBuilder) : IrElemen
}
}
if (type.hasQuestionMark) tBuilder.append(MangleConstant.Q_MARK)
if (type.hasQuestionMark) tBuilder.appendSignature(MangleConstant.Q_MARK)
}
is IrDynamicType -> tBuilder.append(MangleConstant.DYNAMIC_MARK)
is IrDynamicType -> tBuilder.appendSignature(MangleConstant.DYNAMIC_MARK)
else -> error("Unexpected type $type")
}
}
@@ -164,67 +197,64 @@ abstract class IrMangleComputer(protected val builder: StringBuilder) : IrElemen
override fun visitClass(declaration: IrClass, data: Boolean) {
isRealExpect = isRealExpect or declaration.isExpect
typeParameterContainer.add(declaration)
declaration.mangleSimpleDeclaration(MangleConstant.CLASS_PREFIX, data, declaration.name.asString())
if (data && isRealExpect) builder.append(MangleConstant.EXPECT_MARK)
declaration.mangleSimpleDeclaration(declaration.name.asString())
}
override fun visitPackageFragment(declaration: IrPackageFragment, data: Boolean) {
declaration.fqName.let { if (!it.isRoot) builder.append(it.asString()) }
declaration.fqName.let { if (!it.isRoot) builder.appendName(it.asString()) }
}
override fun visitProperty(declaration: IrProperty, data: Boolean) {
val extensionReceiver = declaration.run { (getter ?: setter)?.extensionReceiverParameter }
val prefixLength = addPrefix(MangleConstant.PROPERTY_PREFIX, data)
val accessor = declaration.run { getter ?: setter ?: error("Expected at least one accessor for property ${render()}") }
isRealExpect = isRealExpect or declaration.isExpect
typeParameterContainer.add(declaration)
declaration.parent.accept(this, false)
if (prefixLength != builder.length) builder.append(MangleConstant.FQN_SEPARATOR)
val isStaticProperty = accessor.dispatchReceiverParameter == null && declaration.parent !is IrPackageFragment
if (extensionReceiver != null) {
builder.append(MangleConstant.EXTENSION_RECEIVER_PREFIX)
mangleValueParameter(builder, extensionReceiver)
if (isStaticProperty) {
builder.appendSignature(MangleConstant.STATIC_MEMBER_MARK)
}
builder.append(declaration.name)
if (data && isRealExpect) builder.append(MangleConstant.EXPECT_MARK)
accessor.extensionReceiverParameter?.let {
builder.appendSignature(MangleConstant.EXTENSION_RECEIVER_PREFIX)
mangleValueParameter(builder, it)
}
val typeParameters = accessor.typeParameters
typeParameters.collect(builder, MangleConstant.TYPE_PARAMETERS) { mangleTypeParameter(this, it) }
builder.append(declaration.name.asString())
}
override fun visitField(declaration: IrField, data: Boolean) =
declaration.mangleSimpleDeclaration(MangleConstant.FIELD_PREFIX, data, declaration.name.asString())
declaration.mangleSimpleDeclaration(declaration.name.asString())
override fun visitEnumEntry(declaration: IrEnumEntry, data: Boolean) {
declaration.mangleSimpleDeclaration(MangleConstant.ENUM_ENTRY_PREFIX, data, declaration.name.asString())
if (data && isRealExpect) builder.append(MangleConstant.EXPECT_MARK)
declaration.mangleSimpleDeclaration(declaration.name.asString())
}
override fun visitTypeAlias(declaration: IrTypeAlias, data: Boolean) =
declaration.mangleSimpleDeclaration(MangleConstant.TYPE_ALIAS_PREFIX, data, declaration.name.asString())
declaration.mangleSimpleDeclaration(declaration.name.asString())
override fun visitTypeParameter(declaration: IrTypeParameter, data: Boolean) {
addPrefix(MangleConstant.TYPE_PARAM_PREFIX, data)
declaration.effectiveParent().accept(this, data)
builder.append(MangleConstant.TYPE_PARAM_INDEX_PREFIX)
builder.append(declaration.index)
builder.appendSignature(MangleConstant.TYPE_PARAM_INDEX_PREFIX)
builder.appendSignature(declaration.index)
}
override fun visitSimpleFunction(declaration: IrSimpleFunction, data: Boolean) {
isRealExpect = isRealExpect or declaration.isExpect
declaration.platformSpecificFunctionName?.let {
builder.append(it)
return
}
val container = declaration.correspondingPropertySymbol?.owner ?: declaration
val isStatic = declaration.dispatchReceiverParameter == null && container.parent !is IrPackageFragment
declaration.mangleFunction(false, data, container)
declaration.mangleFunction(false, isStatic, container)
}
override fun visitConstructor(declaration: IrConstructor, data: Boolean) = declaration.mangleFunction(true, data, declaration)
override fun visitConstructor(declaration: IrConstructor, data: Boolean) =
declaration.mangleFunction(isCtor = true, isStatic = false, declaration)
}
@@ -5,7 +5,6 @@
package org.jetbrains.kotlin.ir.backend.js.lower.serialization.metadata
import org.jetbrains.kotlin.backend.common.serialization.DescriptorTable
import org.jetbrains.kotlin.backend.common.serialization.metadata.KlibMetadataSerializer
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.descriptors.CallableDescriptor
@@ -24,9 +23,8 @@ import org.jetbrains.kotlin.serialization.DescriptorSerializer
class KlibMetadataIncrementalSerializer(
languageVersionSettings: LanguageVersionSettings,
metadataVersion: BinaryVersion,
descriptorTable: DescriptorTable,
skipExpects: Boolean
) : KlibMetadataSerializer(languageVersionSettings, metadataVersion, descriptorTable, skipExpects) {
) : KlibMetadataSerializer(languageVersionSettings, metadataVersion, skipExpects) {
fun serializePackageFragment(
module: ModuleDescriptor,
@@ -1,6 +1,5 @@
package org.jetbrains.kotlin.backend.common.serialization.metadata
import org.jetbrains.kotlin.backend.common.serialization.DescriptorTable
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.library.SerializedMetadata
@@ -17,10 +16,9 @@ import org.jetbrains.kotlin.serialization.DescriptorSerializer
class KlibMetadataMonolithicSerializer(
languageVersionSettings: LanguageVersionSettings,
metadataVersion: BinaryVersion,
descriptorTable: DescriptorTable,
skipExpects: Boolean,
includeOnlyModuleContent: Boolean = false
) : KlibMetadataSerializer(languageVersionSettings, metadataVersion, descriptorTable, skipExpects, includeOnlyModuleContent) {
) : KlibMetadataSerializer(languageVersionSettings, metadataVersion, skipExpects, includeOnlyModuleContent) {
private fun serializePackageFragment(fqName: FqName, module: ModuleDescriptor): List<ProtoBuf.PackageFragment> {
@@ -60,7 +58,7 @@ class KlibMetadataMonolithicSerializer(
val packageFqNameStr = packageFqName.asString()
if (packageProtos.all { it.getExtension(KlibMetadataProtoBuf.isEmpty)}) {
if (packageProtos.all { it.getExtension(KlibMetadataProtoBuf.isEmpty) }) {
emptyPackages.add(packageFqNameStr)
}
fragments.add(packageProtos.map { it.toByteArray() })
@@ -5,10 +5,8 @@
package org.jetbrains.kotlin.backend.common.serialization.metadata
import org.jetbrains.kotlin.backend.common.serialization.DescriptorTable
import org.jetbrains.kotlin.backend.common.serialization.isExpectMember
import org.jetbrains.kotlin.backend.common.serialization.isSerializableExpectClass
import org.jetbrains.kotlin.backend.common.serialization.newDescriptorUniqId
import org.jetbrains.kotlin.config.AnalysisFlags
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.descriptors.*
@@ -33,7 +31,6 @@ internal fun <T, R> Iterable<T>.maybeChunked(size: Int?, transform: (List<T>) ->
abstract class KlibMetadataSerializer(
val languageVersionSettings: LanguageVersionSettings,
val metadataVersion: BinaryVersion,
val descriptorTable: DescriptorTable,
val skipExpects: Boolean = false,
val includeOnlyModuleContent: Boolean = false
) {
@@ -46,17 +43,11 @@ abstract class KlibMetadataSerializer(
var classSerializer: DescriptorSerializer = topSerializer
)
private fun declarationTableHandler(declarationDescriptor: DeclarationDescriptor): KlibMetadataProtoBuf.DescriptorUniqId? {
val index = descriptorTable.get(declarationDescriptor) ?: return null
return newDescriptorUniqId(index)
}
protected fun createNewContext(): SerializerContext {
val extension = KlibMetadataSerializerExtension(
languageVersionSettings,
metadataVersion,
::declarationTableHandler,
KlibMetadataStringTable()
)
return SerializerContext(
@@ -21,7 +21,6 @@ import org.jetbrains.kotlin.types.FlexibleType
class KlibMetadataSerializerExtension(
private val languageVersionSettings: LanguageVersionSettings,
override val metadataVersion: BinaryVersion,
val declarationTableHandler: (DeclarationDescriptor) -> KlibMetadataProtoBuf.DescriptorUniqId?,
override val stringTable: StringTableImpl
) : KotlinSerializerExtensionBase(KlibMetadataSerializerProtocol) {
override fun shouldUseTypeTable(): Boolean = true
@@ -35,39 +34,12 @@ class KlibMetadataSerializerExtension(
lowerProto.flexibleTypeCapabilitiesId = stringTable.getStringIndex(DynamicTypeDeserializer.id)
}
private fun uniqId(descriptor: DeclarationDescriptor): KlibMetadataProtoBuf.DescriptorUniqId? {
return declarationTableHandler(descriptor)
}
override fun serializeTypeParameter(typeParameter: TypeParameterDescriptor, proto: ProtoBuf.TypeParameter.Builder) {
uniqId(typeParameter)?.let { proto.setExtension(KlibMetadataProtoBuf.typeParamUniqId, it) }
super.serializeTypeParameter(typeParameter, proto)
}
override fun serializeTypeAlias(typeAlias: TypeAliasDescriptor, proto: ProtoBuf.TypeAlias.Builder) {
uniqId(typeAlias)?.let { proto.setExtension(KlibMetadataProtoBuf.typeAliasUniqId, it) }
super.serializeTypeAlias(typeAlias, proto)
}
override fun serializeEnumEntry(descriptor: ClassDescriptor, proto: ProtoBuf.EnumEntry.Builder) {
uniqId(descriptor)?.let { proto.setExtension(KlibMetadataProtoBuf.enumEntryUniqId, it) }
super.serializeEnumEntry(descriptor, proto)
}
override fun serializeConstructor(descriptor: ConstructorDescriptor, proto: ProtoBuf.Constructor.Builder,
childSerializer: DescriptorSerializer
) {
uniqId(descriptor)?.let { proto.setExtension(KlibMetadataProtoBuf.constructorUniqId, it) }
super.serializeConstructor(descriptor, proto, childSerializer)
}
override fun serializeClass(
descriptor: ClassDescriptor,
proto: ProtoBuf.Class.Builder,
versionRequirementTable: MutableVersionRequirementTable,
childSerializer: DescriptorSerializer
) {
uniqId(descriptor)?.let { proto.setExtension(KlibMetadataProtoBuf.classUniqId, it) }
descriptorFileId(descriptor)?.let { proto.setExtension(KlibMetadataProtoBuf.classFile, it) }
super.serializeClass(descriptor, proto, versionRequirementTable, childSerializer)
childSerializer.typeTable.serialize()?.let { proto.mergeTypeTable(it) }
@@ -79,7 +51,6 @@ class KlibMetadataSerializerExtension(
versionRequirementTable: MutableVersionRequirementTable?,
childSerializer: DescriptorSerializer
) {
uniqId(descriptor)?.let { proto.setExtension(KlibMetadataProtoBuf.propertyUniqId, it) }
descriptorFileId(descriptor)?.let { proto.setExtension(KlibMetadataProtoBuf.propertyFile, it) }
super.serializeProperty(descriptor, proto, versionRequirementTable, childSerializer)
}
@@ -90,7 +61,6 @@ class KlibMetadataSerializerExtension(
versionRequirementTable: MutableVersionRequirementTable?,
childSerializer: DescriptorSerializer
) {
uniqId(descriptor)?.let { proto.setExtension(KlibMetadataProtoBuf.functionUniqId, it) }
descriptorFileId(descriptor)?.let { proto.setExtension(KlibMetadataProtoBuf.functionFile, it) }
super.serializeFunction(descriptor, proto, versionRequirementTable, childSerializer)
}
@@ -4,30 +4,30 @@
package org.jetbrains.kotlin.backend.common.serialization.proto;
/**
* Protobuf type {@code org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeProjection}
* Protobuf type {@code org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature}
*/
public final class IrTypeProjection extends
public final class AccessorIdSignature extends
org.jetbrains.kotlin.protobuf.GeneratedMessageLite implements
// @@protoc_insertion_point(message_implements:org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeProjection)
IrTypeProjectionOrBuilder {
// Use IrTypeProjection.newBuilder() to construct.
private IrTypeProjection(org.jetbrains.kotlin.protobuf.GeneratedMessageLite.Builder builder) {
// @@protoc_insertion_point(message_implements:org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature)
AccessorIdSignatureOrBuilder {
// Use AccessorIdSignature.newBuilder() to construct.
private AccessorIdSignature(org.jetbrains.kotlin.protobuf.GeneratedMessageLite.Builder builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private IrTypeProjection(boolean noInit) { this.unknownFields = org.jetbrains.kotlin.protobuf.ByteString.EMPTY;}
private AccessorIdSignature(boolean noInit) { this.unknownFields = org.jetbrains.kotlin.protobuf.ByteString.EMPTY;}
private static final IrTypeProjection defaultInstance;
public static IrTypeProjection getDefaultInstance() {
private static final AccessorIdSignature defaultInstance;
public static AccessorIdSignature getDefaultInstance() {
return defaultInstance;
}
public IrTypeProjection getDefaultInstanceForType() {
public AccessorIdSignature getDefaultInstanceForType() {
return defaultInstance;
}
private final org.jetbrains.kotlin.protobuf.ByteString unknownFields;
private IrTypeProjection(
private AccessorIdSignature(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
@@ -54,20 +54,23 @@ public final class IrTypeProjection extends
break;
}
case 8: {
int rawValue = input.readEnum();
org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeVariance value = org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeVariance.valueOf(rawValue);
if (value == null) {
unknownFieldsCodedOutput.writeRawVarint32(tag);
unknownFieldsCodedOutput.writeRawVarint32(rawValue);
} else {
bitField0_ |= 0x00000001;
variance_ = value;
}
bitField0_ |= 0x00000001;
propertySignature_ = input.readInt32();
break;
}
case 16: {
bitField0_ |= 0x00000002;
type_ = input.readInt32();
name_ = input.readInt32();
break;
}
case 24: {
bitField0_ |= 0x00000004;
accessorHashId_ = input.readInt64();
break;
}
case 32: {
bitField0_ |= 0x00000008;
flags_ = input.readInt64();
break;
}
}
@@ -88,55 +91,87 @@ public final class IrTypeProjection extends
makeExtensionsImmutable();
}
}
public static org.jetbrains.kotlin.protobuf.Parser<IrTypeProjection> PARSER =
new org.jetbrains.kotlin.protobuf.AbstractParser<IrTypeProjection>() {
public IrTypeProjection parsePartialFrom(
public static org.jetbrains.kotlin.protobuf.Parser<AccessorIdSignature> PARSER =
new org.jetbrains.kotlin.protobuf.AbstractParser<AccessorIdSignature>() {
public AccessorIdSignature parsePartialFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return new IrTypeProjection(input, extensionRegistry);
return new AccessorIdSignature(input, extensionRegistry);
}
};
@java.lang.Override
public org.jetbrains.kotlin.protobuf.Parser<IrTypeProjection> getParserForType() {
public org.jetbrains.kotlin.protobuf.Parser<AccessorIdSignature> getParserForType() {
return PARSER;
}
private int bitField0_;
public static final int VARIANCE_FIELD_NUMBER = 1;
private org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeVariance variance_;
public static final int PROPERTY_SIGNATURE_FIELD_NUMBER = 1;
private int propertySignature_;
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeVariance variance = 1;</code>
* <code>required int32 property_signature = 1;</code>
*/
public boolean hasVariance() {
public boolean hasPropertySignature() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeVariance variance = 1;</code>
* <code>required int32 property_signature = 1;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeVariance getVariance() {
return variance_;
public int getPropertySignature() {
return propertySignature_;
}
public static final int TYPE_FIELD_NUMBER = 2;
private int type_;
public static final int NAME_FIELD_NUMBER = 2;
private int name_;
/**
* <code>required int32 type = 2;</code>
* <code>required int32 name = 2;</code>
*/
public boolean hasType() {
public boolean hasName() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required int32 type = 2;</code>
* <code>required int32 name = 2;</code>
*/
public int getType() {
return type_;
public int getName() {
return name_;
}
public static final int ACCESSOR_HASH_ID_FIELD_NUMBER = 3;
private long accessorHashId_;
/**
* <code>required int64 accessor_hash_id = 3;</code>
*/
public boolean hasAccessorHashId() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required int64 accessor_hash_id = 3;</code>
*/
public long getAccessorHashId() {
return accessorHashId_;
}
public static final int FLAGS_FIELD_NUMBER = 4;
private long flags_;
/**
* <code>optional int64 flags = 4 [default = 0];</code>
*/
public boolean hasFlags() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>optional int64 flags = 4 [default = 0];</code>
*/
public long getFlags() {
return flags_;
}
private void initFields() {
variance_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeVariance.IN;
type_ = 0;
propertySignature_ = 0;
name_ = 0;
accessorHashId_ = 0L;
flags_ = 0L;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
@@ -144,11 +179,15 @@ public final class IrTypeProjection extends
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!hasVariance()) {
if (!hasPropertySignature()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasType()) {
if (!hasName()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasAccessorHashId()) {
memoizedIsInitialized = 0;
return false;
}
@@ -160,10 +199,16 @@ public final class IrTypeProjection extends
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeEnum(1, variance_.getNumber());
output.writeInt32(1, propertySignature_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeInt32(2, type_);
output.writeInt32(2, name_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeInt64(3, accessorHashId_);
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
output.writeInt64(4, flags_);
}
output.writeRawBytes(unknownFields);
}
@@ -176,11 +221,19 @@ public final class IrTypeProjection extends
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeEnumSize(1, variance_.getNumber());
.computeInt32Size(1, propertySignature_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(2, type_);
.computeInt32Size(2, name_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt64Size(3, accessorHashId_);
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt64Size(4, flags_);
}
size += unknownFields.size();
memoizedSerializedSize = size;
@@ -194,53 +247,53 @@ public final class IrTypeProjection extends
return super.writeReplace();
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeProjection parseFrom(
public static org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature parseFrom(
org.jetbrains.kotlin.protobuf.ByteString data)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeProjection parseFrom(
public static org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature parseFrom(
org.jetbrains.kotlin.protobuf.ByteString data,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeProjection parseFrom(byte[] data)
public static org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature parseFrom(byte[] data)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeProjection parseFrom(
public static org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature parseFrom(
byte[] data,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeProjection parseFrom(java.io.InputStream input)
public static org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeProjection parseFrom(
public static org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature parseFrom(
java.io.InputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeProjection parseDelimitedFrom(java.io.InputStream input)
public static org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeProjection parseDelimitedFrom(
public static org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature parseDelimitedFrom(
java.io.InputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeProjection parseFrom(
public static org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature parseFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeProjection parseFrom(
public static org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature parseFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
@@ -249,21 +302,21 @@ public final class IrTypeProjection extends
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeProjection prototype) {
public static Builder newBuilder(org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
/**
* Protobuf type {@code org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeProjection}
* Protobuf type {@code org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature}
*/
public static final class Builder extends
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.Builder<
org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeProjection, Builder>
org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature, Builder>
implements
// @@protoc_insertion_point(builder_implements:org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeProjection)
org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeProjectionOrBuilder {
// Construct using org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeProjection.newBuilder()
// @@protoc_insertion_point(builder_implements:org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature)
org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignatureOrBuilder {
// Construct using org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
@@ -276,10 +329,14 @@ public final class IrTypeProjection extends
public Builder clear() {
super.clear();
variance_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeVariance.IN;
propertySignature_ = 0;
bitField0_ = (bitField0_ & ~0x00000001);
type_ = 0;
name_ = 0;
bitField0_ = (bitField0_ & ~0x00000002);
accessorHashId_ = 0L;
bitField0_ = (bitField0_ & ~0x00000004);
flags_ = 0L;
bitField0_ = (bitField0_ & ~0x00000008);
return this;
}
@@ -287,41 +344,55 @@ public final class IrTypeProjection extends
return create().mergeFrom(buildPartial());
}
public org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeProjection getDefaultInstanceForType() {
return org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeProjection.getDefaultInstance();
public org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature getDefaultInstanceForType() {
return org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature.getDefaultInstance();
}
public org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeProjection build() {
org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeProjection result = buildPartial();
public org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature build() {
org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeProjection buildPartial() {
org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeProjection result = new org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeProjection(this);
public org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature buildPartial() {
org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature result = new org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.variance_ = variance_;
result.propertySignature_ = propertySignature_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.type_ = type_;
result.name_ = name_;
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
to_bitField0_ |= 0x00000004;
}
result.accessorHashId_ = accessorHashId_;
if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
to_bitField0_ |= 0x00000008;
}
result.flags_ = flags_;
result.bitField0_ = to_bitField0_;
return result;
}
public Builder mergeFrom(org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeProjection other) {
if (other == org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeProjection.getDefaultInstance()) return this;
if (other.hasVariance()) {
setVariance(other.getVariance());
public Builder mergeFrom(org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature other) {
if (other == org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature.getDefaultInstance()) return this;
if (other.hasPropertySignature()) {
setPropertySignature(other.getPropertySignature());
}
if (other.hasType()) {
setType(other.getType());
if (other.hasName()) {
setName(other.getName());
}
if (other.hasAccessorHashId()) {
setAccessorHashId(other.getAccessorHashId());
}
if (other.hasFlags()) {
setFlags(other.getFlags());
}
setUnknownFields(
getUnknownFields().concat(other.unknownFields));
@@ -329,11 +400,15 @@ public final class IrTypeProjection extends
}
public final boolean isInitialized() {
if (!hasVariance()) {
if (!hasPropertySignature()) {
return false;
}
if (!hasType()) {
if (!hasName()) {
return false;
}
if (!hasAccessorHashId()) {
return false;
}
@@ -344,11 +419,11 @@ public final class IrTypeProjection extends
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeProjection parsedMessage = null;
org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeProjection) e.getUnfinishedMessage();
parsedMessage = (org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
@@ -359,80 +434,141 @@ public final class IrTypeProjection extends
}
private int bitField0_;
private org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeVariance variance_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeVariance.IN;
private int propertySignature_ ;
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeVariance variance = 1;</code>
* <code>required int32 property_signature = 1;</code>
*/
public boolean hasVariance() {
public boolean hasPropertySignature() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeVariance variance = 1;</code>
* <code>required int32 property_signature = 1;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeVariance getVariance() {
return variance_;
public int getPropertySignature() {
return propertySignature_;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeVariance variance = 1;</code>
* <code>required int32 property_signature = 1;</code>
*/
public Builder setVariance(org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeVariance value) {
if (value == null) {
throw new NullPointerException();
}
public Builder setPropertySignature(int value) {
bitField0_ |= 0x00000001;
variance_ = value;
propertySignature_ = value;
return this;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeVariance variance = 1;</code>
* <code>required int32 property_signature = 1;</code>
*/
public Builder clearVariance() {
public Builder clearPropertySignature() {
bitField0_ = (bitField0_ & ~0x00000001);
variance_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeVariance.IN;
propertySignature_ = 0;
return this;
}
private int type_ ;
private int name_ ;
/**
* <code>required int32 type = 2;</code>
* <code>required int32 name = 2;</code>
*/
public boolean hasType() {
public boolean hasName() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required int32 type = 2;</code>
* <code>required int32 name = 2;</code>
*/
public int getType() {
return type_;
public int getName() {
return name_;
}
/**
* <code>required int32 type = 2;</code>
* <code>required int32 name = 2;</code>
*/
public Builder setType(int value) {
public Builder setName(int value) {
bitField0_ |= 0x00000002;
type_ = value;
name_ = value;
return this;
}
/**
* <code>required int32 type = 2;</code>
* <code>required int32 name = 2;</code>
*/
public Builder clearType() {
public Builder clearName() {
bitField0_ = (bitField0_ & ~0x00000002);
type_ = 0;
name_ = 0;
return this;
}
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeProjection)
private long accessorHashId_ ;
/**
* <code>required int64 accessor_hash_id = 3;</code>
*/
public boolean hasAccessorHashId() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required int64 accessor_hash_id = 3;</code>
*/
public long getAccessorHashId() {
return accessorHashId_;
}
/**
* <code>required int64 accessor_hash_id = 3;</code>
*/
public Builder setAccessorHashId(long value) {
bitField0_ |= 0x00000004;
accessorHashId_ = value;
return this;
}
/**
* <code>required int64 accessor_hash_id = 3;</code>
*/
public Builder clearAccessorHashId() {
bitField0_ = (bitField0_ & ~0x00000004);
accessorHashId_ = 0L;
return this;
}
private long flags_ ;
/**
* <code>optional int64 flags = 4 [default = 0];</code>
*/
public boolean hasFlags() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>optional int64 flags = 4 [default = 0];</code>
*/
public long getFlags() {
return flags_;
}
/**
* <code>optional int64 flags = 4 [default = 0];</code>
*/
public Builder setFlags(long value) {
bitField0_ |= 0x00000008;
flags_ = value;
return this;
}
/**
* <code>optional int64 flags = 4 [default = 0];</code>
*/
public Builder clearFlags() {
bitField0_ = (bitField0_ & ~0x00000008);
flags_ = 0L;
return this;
}
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature)
}
static {
defaultInstance = new IrTypeProjection(true);
defaultInstance = new AccessorIdSignature(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeProjection)
// @@protoc_insertion_point(class_scope:org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature)
}
@@ -0,0 +1,45 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: compiler/ir/serialization.common/src/KotlinIr.proto
package org.jetbrains.kotlin.backend.common.serialization.proto;
public interface AccessorIdSignatureOrBuilder extends
// @@protoc_insertion_point(interface_extends:org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature)
org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder {
/**
* <code>required int32 property_signature = 1;</code>
*/
boolean hasPropertySignature();
/**
* <code>required int32 property_signature = 1;</code>
*/
int getPropertySignature();
/**
* <code>required int32 name = 2;</code>
*/
boolean hasName();
/**
* <code>required int32 name = 2;</code>
*/
int getName();
/**
* <code>required int64 accessor_hash_id = 3;</code>
*/
boolean hasAccessorHashId();
/**
* <code>required int64 accessor_hash_id = 3;</code>
*/
long getAccessorHashId();
/**
* <code>optional int64 flags = 4 [default = 0];</code>
*/
boolean hasFlags();
/**
* <code>optional int64 flags = 4 [default = 0];</code>
*/
long getFlags();
}
@@ -55,12 +55,12 @@ public final class Actual extends
}
case 8: {
bitField0_ |= 0x00000001;
actualSymbol_ = input.readInt32();
actualSymbol_ = input.readInt64();
break;
}
case 16: {
bitField0_ |= 0x00000002;
expectSymbol_ = input.readInt32();
expectSymbol_ = input.readInt64();
break;
}
}
@@ -98,38 +98,38 @@ public final class Actual extends
private int bitField0_;
public static final int ACTUAL_SYMBOL_FIELD_NUMBER = 1;
private int actualSymbol_;
private long actualSymbol_;
/**
* <code>required int32 actual_symbol = 1;</code>
* <code>required int64 actual_symbol = 1;</code>
*/
public boolean hasActualSymbol() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int32 actual_symbol = 1;</code>
* <code>required int64 actual_symbol = 1;</code>
*/
public int getActualSymbol() {
public long getActualSymbol() {
return actualSymbol_;
}
public static final int EXPECT_SYMBOL_FIELD_NUMBER = 2;
private int expectSymbol_;
private long expectSymbol_;
/**
* <code>required int32 expect_symbol = 2;</code>
* <code>required int64 expect_symbol = 2;</code>
*/
public boolean hasExpectSymbol() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required int32 expect_symbol = 2;</code>
* <code>required int64 expect_symbol = 2;</code>
*/
public int getExpectSymbol() {
public long getExpectSymbol() {
return expectSymbol_;
}
private void initFields() {
actualSymbol_ = 0;
expectSymbol_ = 0;
actualSymbol_ = 0L;
expectSymbol_ = 0L;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
@@ -153,10 +153,10 @@ public final class Actual extends
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeInt32(1, actualSymbol_);
output.writeInt64(1, actualSymbol_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeInt32(2, expectSymbol_);
output.writeInt64(2, expectSymbol_);
}
output.writeRawBytes(unknownFields);
}
@@ -169,11 +169,11 @@ public final class Actual extends
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(1, actualSymbol_);
.computeInt64Size(1, actualSymbol_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(2, expectSymbol_);
.computeInt64Size(2, expectSymbol_);
}
size += unknownFields.size();
memoizedSerializedSize = size;
@@ -269,9 +269,9 @@ public final class Actual extends
public Builder clear() {
super.clear();
actualSymbol_ = 0;
actualSymbol_ = 0L;
bitField0_ = (bitField0_ & ~0x00000001);
expectSymbol_ = 0;
expectSymbol_ = 0L;
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
@@ -352,66 +352,66 @@ public final class Actual extends
}
private int bitField0_;
private int actualSymbol_ ;
private long actualSymbol_ ;
/**
* <code>required int32 actual_symbol = 1;</code>
* <code>required int64 actual_symbol = 1;</code>
*/
public boolean hasActualSymbol() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int32 actual_symbol = 1;</code>
* <code>required int64 actual_symbol = 1;</code>
*/
public int getActualSymbol() {
public long getActualSymbol() {
return actualSymbol_;
}
/**
* <code>required int32 actual_symbol = 1;</code>
* <code>required int64 actual_symbol = 1;</code>
*/
public Builder setActualSymbol(int value) {
public Builder setActualSymbol(long value) {
bitField0_ |= 0x00000001;
actualSymbol_ = value;
return this;
}
/**
* <code>required int32 actual_symbol = 1;</code>
* <code>required int64 actual_symbol = 1;</code>
*/
public Builder clearActualSymbol() {
bitField0_ = (bitField0_ & ~0x00000001);
actualSymbol_ = 0;
actualSymbol_ = 0L;
return this;
}
private int expectSymbol_ ;
private long expectSymbol_ ;
/**
* <code>required int32 expect_symbol = 2;</code>
* <code>required int64 expect_symbol = 2;</code>
*/
public boolean hasExpectSymbol() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required int32 expect_symbol = 2;</code>
* <code>required int64 expect_symbol = 2;</code>
*/
public int getExpectSymbol() {
public long getExpectSymbol() {
return expectSymbol_;
}
/**
* <code>required int32 expect_symbol = 2;</code>
* <code>required int64 expect_symbol = 2;</code>
*/
public Builder setExpectSymbol(int value) {
public Builder setExpectSymbol(long value) {
bitField0_ |= 0x00000002;
expectSymbol_ = value;
return this;
}
/**
* <code>required int32 expect_symbol = 2;</code>
* <code>required int64 expect_symbol = 2;</code>
*/
public Builder clearExpectSymbol() {
bitField0_ = (bitField0_ & ~0x00000002);
expectSymbol_ = 0;
expectSymbol_ = 0L;
return this;
}
@@ -8,20 +8,20 @@ public interface ActualOrBuilder extends
org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder {
/**
* <code>required int32 actual_symbol = 1;</code>
* <code>required int64 actual_symbol = 1;</code>
*/
boolean hasActualSymbol();
/**
* <code>required int32 actual_symbol = 1;</code>
* <code>required int64 actual_symbol = 1;</code>
*/
int getActualSymbol();
long getActualSymbol();
/**
* <code>required int32 expect_symbol = 2;</code>
* <code>required int64 expect_symbol = 2;</code>
*/
boolean hasExpectSymbol();
/**
* <code>required int32 expect_symbol = 2;</code>
* <code>required int64 expect_symbol = 2;</code>
*/
int getExpectSymbol();
long getExpectSymbol();
}
@@ -1,96 +0,0 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: compiler/ir/serialization.common/src/KotlinIr.proto
package org.jetbrains.kotlin.backend.common.serialization.proto;
/**
* Protobuf enum {@code org.jetbrains.kotlin.backend.common.serialization.proto.ClassKind}
*/
public enum ClassKind
implements org.jetbrains.kotlin.protobuf.Internal.EnumLite {
/**
* <code>CLASS = 1;</code>
*/
CLASS(0, 1),
/**
* <code>INTERFACE = 2;</code>
*/
INTERFACE(1, 2),
/**
* <code>ENUM_CLASS = 3;</code>
*/
ENUM_CLASS(2, 3),
/**
* <code>ENUM_ENTRY = 4;</code>
*/
ENUM_ENTRY(3, 4),
/**
* <code>ANNOTATION_CLASS = 5;</code>
*/
ANNOTATION_CLASS(4, 5),
/**
* <code>OBJECT = 6;</code>
*/
OBJECT(5, 6),
;
/**
* <code>CLASS = 1;</code>
*/
public static final int CLASS_VALUE = 1;
/**
* <code>INTERFACE = 2;</code>
*/
public static final int INTERFACE_VALUE = 2;
/**
* <code>ENUM_CLASS = 3;</code>
*/
public static final int ENUM_CLASS_VALUE = 3;
/**
* <code>ENUM_ENTRY = 4;</code>
*/
public static final int ENUM_ENTRY_VALUE = 4;
/**
* <code>ANNOTATION_CLASS = 5;</code>
*/
public static final int ANNOTATION_CLASS_VALUE = 5;
/**
* <code>OBJECT = 6;</code>
*/
public static final int OBJECT_VALUE = 6;
public final int getNumber() { return value; }
public static ClassKind valueOf(int value) {
switch (value) {
case 1: return CLASS;
case 2: return INTERFACE;
case 3: return ENUM_CLASS;
case 4: return ENUM_ENTRY;
case 5: return ANNOTATION_CLASS;
case 6: return OBJECT;
default: return null;
}
}
public static org.jetbrains.kotlin.protobuf.Internal.EnumLiteMap<ClassKind>
internalGetValueMap() {
return internalValueMap;
}
private static org.jetbrains.kotlin.protobuf.Internal.EnumLiteMap<ClassKind>
internalValueMap =
new org.jetbrains.kotlin.protobuf.Internal.EnumLiteMap<ClassKind>() {
public ClassKind findValueByNumber(int number) {
return ClassKind.valueOf(number);
}
};
private final int value;
private ClassKind(int index, int value) {
this.value = value;
}
// @@protoc_insertion_point(enum_scope:org.jetbrains.kotlin.backend.common.serialization.proto.ClassKind)
}
@@ -1,27 +0,0 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: compiler/ir/serialization.common/src/KotlinIr.proto
package org.jetbrains.kotlin.backend.common.serialization.proto;
public interface CoordinatesOrBuilder extends
// @@protoc_insertion_point(interface_extends:org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates)
org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder {
/**
* <code>required int32 start_offset = 1;</code>
*/
boolean hasStartOffset();
/**
* <code>required int32 start_offset = 1;</code>
*/
int getStartOffset();
/**
* <code>required int32 end_offset = 2;</code>
*/
boolean hasEndOffset();
/**
* <code>required int32 end_offset = 2;</code>
*/
int getEndOffset();
}
@@ -1,62 +0,0 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: compiler/ir/serialization.common/src/KotlinIr.proto
package org.jetbrains.kotlin.backend.common.serialization.proto;
public interface DescriptorReferenceOrBuilder extends
// @@protoc_insertion_point(interface_extends:org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference)
org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder {
/**
* <code>repeated int32 package_fq_name = 1;</code>
*/
java.util.List<java.lang.Integer> getPackageFqNameList();
/**
* <code>repeated int32 package_fq_name = 1;</code>
*/
int getPackageFqNameCount();
/**
* <code>repeated int32 package_fq_name = 1;</code>
*/
int getPackageFqName(int index);
/**
* <code>repeated int32 class_fq_name = 2;</code>
*/
java.util.List<java.lang.Integer> getClassFqNameList();
/**
* <code>repeated int32 class_fq_name = 2;</code>
*/
int getClassFqNameCount();
/**
* <code>repeated int32 class_fq_name = 2;</code>
*/
int getClassFqName(int index);
/**
* <code>required int32 name = 3;</code>
*/
boolean hasName();
/**
* <code>required int32 name = 3;</code>
*/
int getName();
/**
* <code>required int32 flags = 4;</code>
*/
boolean hasFlags();
/**
* <code>required int32 flags = 4;</code>
*/
int getFlags();
/**
* <code>optional int64 uniq_id_index = 5;</code>
*/
boolean hasUniqIdIndex();
/**
* <code>optional int64 uniq_id_index = 5;</code>
*/
long getUniqIdIndex();
}
@@ -55,12 +55,12 @@ public final class FieldAccessCommon extends
}
case 8: {
bitField0_ |= 0x00000001;
symbol_ = input.readInt32();
symbol_ = input.readInt64();
break;
}
case 16: {
bitField0_ |= 0x00000002;
super_ = input.readInt32();
super_ = input.readInt64();
break;
}
case 26: {
@@ -111,32 +111,32 @@ public final class FieldAccessCommon extends
private int bitField0_;
public static final int SYMBOL_FIELD_NUMBER = 1;
private int symbol_;
private long symbol_;
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public boolean hasSymbol() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public int getSymbol() {
public long getSymbol() {
return symbol_;
}
public static final int SUPER_FIELD_NUMBER = 2;
private int super_;
private long super_;
/**
* <code>optional int32 super = 2;</code>
* <code>optional int64 super = 2;</code>
*/
public boolean hasSuper() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>optional int32 super = 2;</code>
* <code>optional int64 super = 2;</code>
*/
public int getSuper() {
public long getSuper() {
return super_;
}
@@ -156,8 +156,8 @@ public final class FieldAccessCommon extends
}
private void initFields() {
symbol_ = 0;
super_ = 0;
symbol_ = 0L;
super_ = 0L;
receiver_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrExpression.getDefaultInstance();
}
private byte memoizedIsInitialized = -1;
@@ -184,10 +184,10 @@ public final class FieldAccessCommon extends
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeInt32(1, symbol_);
output.writeInt64(1, symbol_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeInt32(2, super_);
output.writeInt64(2, super_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeMessage(3, receiver_);
@@ -203,11 +203,11 @@ public final class FieldAccessCommon extends
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(1, symbol_);
.computeInt64Size(1, symbol_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(2, super_);
.computeInt64Size(2, super_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
@@ -307,9 +307,9 @@ public final class FieldAccessCommon extends
public Builder clear() {
super.clear();
symbol_ = 0;
symbol_ = 0L;
bitField0_ = (bitField0_ & ~0x00000001);
super_ = 0;
super_ = 0L;
bitField0_ = (bitField0_ & ~0x00000002);
receiver_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrExpression.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000004);
@@ -401,66 +401,66 @@ public final class FieldAccessCommon extends
}
private int bitField0_;
private int symbol_ ;
private long symbol_ ;
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public boolean hasSymbol() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public int getSymbol() {
public long getSymbol() {
return symbol_;
}
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public Builder setSymbol(int value) {
public Builder setSymbol(long value) {
bitField0_ |= 0x00000001;
symbol_ = value;
return this;
}
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public Builder clearSymbol() {
bitField0_ = (bitField0_ & ~0x00000001);
symbol_ = 0;
symbol_ = 0L;
return this;
}
private int super_ ;
private long super_ ;
/**
* <code>optional int32 super = 2;</code>
* <code>optional int64 super = 2;</code>
*/
public boolean hasSuper() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>optional int32 super = 2;</code>
* <code>optional int64 super = 2;</code>
*/
public int getSuper() {
public long getSuper() {
return super_;
}
/**
* <code>optional int32 super = 2;</code>
* <code>optional int64 super = 2;</code>
*/
public Builder setSuper(int value) {
public Builder setSuper(long value) {
bitField0_ |= 0x00000002;
super_ = value;
return this;
}
/**
* <code>optional int32 super = 2;</code>
* <code>optional int64 super = 2;</code>
*/
public Builder clearSuper() {
bitField0_ = (bitField0_ & ~0x00000002);
super_ = 0;
super_ = 0L;
return this;
}
@@ -8,22 +8,22 @@ public interface FieldAccessCommonOrBuilder extends
org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder {
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
boolean hasSymbol();
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
int getSymbol();
long getSymbol();
/**
* <code>optional int32 super = 2;</code>
* <code>optional int64 super = 2;</code>
*/
boolean hasSuper();
/**
* <code>optional int32 super = 2;</code>
* <code>optional int64 super = 2;</code>
*/
int getSuper();
long getSuper();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrExpression receiver = 3;</code>
@@ -162,24 +162,25 @@ public final class FileEntry extends
public static final int LINE_START_OFFSETS_FIELD_NUMBER = 2;
private java.util.List<java.lang.Integer> lineStartOffsets_;
/**
* <code>repeated int32 line_start_offsets = 2;</code>
* <code>repeated int32 line_start_offsets = 2 [packed = true];</code>
*/
public java.util.List<java.lang.Integer>
getLineStartOffsetsList() {
return lineStartOffsets_;
}
/**
* <code>repeated int32 line_start_offsets = 2;</code>
* <code>repeated int32 line_start_offsets = 2 [packed = true];</code>
*/
public int getLineStartOffsetsCount() {
return lineStartOffsets_.size();
}
/**
* <code>repeated int32 line_start_offsets = 2;</code>
* <code>repeated int32 line_start_offsets = 2 [packed = true];</code>
*/
public int getLineStartOffsets(int index) {
return lineStartOffsets_.get(index);
}
private int lineStartOffsetsMemoizedSerializedSize = -1;
private void initFields() {
name_ = "";
@@ -205,8 +206,12 @@ public final class FileEntry extends
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(1, getNameBytes());
}
if (getLineStartOffsetsList().size() > 0) {
output.writeRawVarint32(18);
output.writeRawVarint32(lineStartOffsetsMemoizedSerializedSize);
}
for (int i = 0; i < lineStartOffsets_.size(); i++) {
output.writeInt32(2, lineStartOffsets_.get(i));
output.writeInt32NoTag(lineStartOffsets_.get(i));
}
output.writeRawBytes(unknownFields);
}
@@ -228,7 +233,12 @@ public final class FileEntry extends
.computeInt32SizeNoTag(lineStartOffsets_.get(i));
}
size += dataSize;
size += 1 * getLineStartOffsetsList().size();
if (!getLineStartOffsetsList().isEmpty()) {
size += 1;
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32SizeNoTag(dataSize);
}
lineStartOffsetsMemoizedSerializedSize = dataSize;
}
size += unknownFields.size();
memoizedSerializedSize = size;
@@ -497,26 +507,26 @@ public final class FileEntry extends
}
}
/**
* <code>repeated int32 line_start_offsets = 2;</code>
* <code>repeated int32 line_start_offsets = 2 [packed = true];</code>
*/
public java.util.List<java.lang.Integer>
getLineStartOffsetsList() {
return java.util.Collections.unmodifiableList(lineStartOffsets_);
}
/**
* <code>repeated int32 line_start_offsets = 2;</code>
* <code>repeated int32 line_start_offsets = 2 [packed = true];</code>
*/
public int getLineStartOffsetsCount() {
return lineStartOffsets_.size();
}
/**
* <code>repeated int32 line_start_offsets = 2;</code>
* <code>repeated int32 line_start_offsets = 2 [packed = true];</code>
*/
public int getLineStartOffsets(int index) {
return lineStartOffsets_.get(index);
}
/**
* <code>repeated int32 line_start_offsets = 2;</code>
* <code>repeated int32 line_start_offsets = 2 [packed = true];</code>
*/
public Builder setLineStartOffsets(
int index, int value) {
@@ -526,7 +536,7 @@ public final class FileEntry extends
return this;
}
/**
* <code>repeated int32 line_start_offsets = 2;</code>
* <code>repeated int32 line_start_offsets = 2 [packed = true];</code>
*/
public Builder addLineStartOffsets(int value) {
ensureLineStartOffsetsIsMutable();
@@ -535,7 +545,7 @@ public final class FileEntry extends
return this;
}
/**
* <code>repeated int32 line_start_offsets = 2;</code>
* <code>repeated int32 line_start_offsets = 2 [packed = true];</code>
*/
public Builder addAllLineStartOffsets(
java.lang.Iterable<? extends java.lang.Integer> values) {
@@ -546,7 +556,7 @@ public final class FileEntry extends
return this;
}
/**
* <code>repeated int32 line_start_offsets = 2;</code>
* <code>repeated int32 line_start_offsets = 2 [packed = true];</code>
*/
public Builder clearLineStartOffsets() {
lineStartOffsets_ = java.util.Collections.emptyList();
@@ -22,15 +22,15 @@ public interface FileEntryOrBuilder extends
getNameBytes();
/**
* <code>repeated int32 line_start_offsets = 2;</code>
* <code>repeated int32 line_start_offsets = 2 [packed = true];</code>
*/
java.util.List<java.lang.Integer> getLineStartOffsetsList();
/**
* <code>repeated int32 line_start_offsets = 2;</code>
* <code>repeated int32 line_start_offsets = 2 [packed = true];</code>
*/
int getLineStartOffsetsCount();
/**
* <code>repeated int32 line_start_offsets = 2;</code>
* <code>repeated int32 line_start_offsets = 2 [packed = true];</code>
*/
int getLineStartOffsets(int index);
}
@@ -4,30 +4,30 @@
package org.jetbrains.kotlin.backend.common.serialization.proto;
/**
* Protobuf type {@code org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates}
* Protobuf type {@code org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature}
*/
public final class Coordinates extends
public final class FileLocalIdSignature extends
org.jetbrains.kotlin.protobuf.GeneratedMessageLite implements
// @@protoc_insertion_point(message_implements:org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates)
CoordinatesOrBuilder {
// Use Coordinates.newBuilder() to construct.
private Coordinates(org.jetbrains.kotlin.protobuf.GeneratedMessageLite.Builder builder) {
// @@protoc_insertion_point(message_implements:org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature)
FileLocalIdSignatureOrBuilder {
// Use FileLocalIdSignature.newBuilder() to construct.
private FileLocalIdSignature(org.jetbrains.kotlin.protobuf.GeneratedMessageLite.Builder builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private Coordinates(boolean noInit) { this.unknownFields = org.jetbrains.kotlin.protobuf.ByteString.EMPTY;}
private FileLocalIdSignature(boolean noInit) { this.unknownFields = org.jetbrains.kotlin.protobuf.ByteString.EMPTY;}
private static final Coordinates defaultInstance;
public static Coordinates getDefaultInstance() {
private static final FileLocalIdSignature defaultInstance;
public static FileLocalIdSignature getDefaultInstance() {
return defaultInstance;
}
public Coordinates getDefaultInstanceForType() {
public FileLocalIdSignature getDefaultInstanceForType() {
return defaultInstance;
}
private final org.jetbrains.kotlin.protobuf.ByteString unknownFields;
private Coordinates(
private FileLocalIdSignature(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
@@ -55,12 +55,12 @@ public final class Coordinates extends
}
case 8: {
bitField0_ |= 0x00000001;
startOffset_ = input.readInt32();
container_ = input.readInt32();
break;
}
case 16: {
bitField0_ |= 0x00000002;
endOffset_ = input.readInt32();
localId_ = input.readInt64();
break;
}
}
@@ -81,55 +81,55 @@ public final class Coordinates extends
makeExtensionsImmutable();
}
}
public static org.jetbrains.kotlin.protobuf.Parser<Coordinates> PARSER =
new org.jetbrains.kotlin.protobuf.AbstractParser<Coordinates>() {
public Coordinates parsePartialFrom(
public static org.jetbrains.kotlin.protobuf.Parser<FileLocalIdSignature> PARSER =
new org.jetbrains.kotlin.protobuf.AbstractParser<FileLocalIdSignature>() {
public FileLocalIdSignature parsePartialFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return new Coordinates(input, extensionRegistry);
return new FileLocalIdSignature(input, extensionRegistry);
}
};
@java.lang.Override
public org.jetbrains.kotlin.protobuf.Parser<Coordinates> getParserForType() {
public org.jetbrains.kotlin.protobuf.Parser<FileLocalIdSignature> getParserForType() {
return PARSER;
}
private int bitField0_;
public static final int START_OFFSET_FIELD_NUMBER = 1;
private int startOffset_;
public static final int CONTAINER_FIELD_NUMBER = 1;
private int container_;
/**
* <code>required int32 start_offset = 1;</code>
* <code>required int32 container = 1;</code>
*/
public boolean hasStartOffset() {
public boolean hasContainer() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int32 start_offset = 1;</code>
* <code>required int32 container = 1;</code>
*/
public int getStartOffset() {
return startOffset_;
public int getContainer() {
return container_;
}
public static final int END_OFFSET_FIELD_NUMBER = 2;
private int endOffset_;
public static final int LOCAL_ID_FIELD_NUMBER = 2;
private long localId_;
/**
* <code>required int32 end_offset = 2;</code>
* <code>required int64 local_id = 2;</code>
*/
public boolean hasEndOffset() {
public boolean hasLocalId() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required int32 end_offset = 2;</code>
* <code>required int64 local_id = 2;</code>
*/
public int getEndOffset() {
return endOffset_;
public long getLocalId() {
return localId_;
}
private void initFields() {
startOffset_ = 0;
endOffset_ = 0;
container_ = 0;
localId_ = 0L;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
@@ -137,11 +137,11 @@ public final class Coordinates extends
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!hasStartOffset()) {
if (!hasContainer()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasEndOffset()) {
if (!hasLocalId()) {
memoizedIsInitialized = 0;
return false;
}
@@ -153,10 +153,10 @@ public final class Coordinates extends
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeInt32(1, startOffset_);
output.writeInt32(1, container_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeInt32(2, endOffset_);
output.writeInt64(2, localId_);
}
output.writeRawBytes(unknownFields);
}
@@ -169,11 +169,11 @@ public final class Coordinates extends
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(1, startOffset_);
.computeInt32Size(1, container_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(2, endOffset_);
.computeInt64Size(2, localId_);
}
size += unknownFields.size();
memoizedSerializedSize = size;
@@ -187,53 +187,53 @@ public final class Coordinates extends
return super.writeReplace();
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates parseFrom(
public static org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature parseFrom(
org.jetbrains.kotlin.protobuf.ByteString data)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates parseFrom(
public static org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature parseFrom(
org.jetbrains.kotlin.protobuf.ByteString data,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates parseFrom(byte[] data)
public static org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature parseFrom(byte[] data)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates parseFrom(
public static org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature parseFrom(
byte[] data,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates parseFrom(java.io.InputStream input)
public static org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates parseFrom(
public static org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature parseFrom(
java.io.InputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates parseDelimitedFrom(java.io.InputStream input)
public static org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates parseDelimitedFrom(
public static org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature parseDelimitedFrom(
java.io.InputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates parseFrom(
public static org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature parseFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates parseFrom(
public static org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature parseFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
@@ -242,21 +242,21 @@ public final class Coordinates extends
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates prototype) {
public static Builder newBuilder(org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
/**
* Protobuf type {@code org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates}
* Protobuf type {@code org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature}
*/
public static final class Builder extends
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.Builder<
org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates, Builder>
org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature, Builder>
implements
// @@protoc_insertion_point(builder_implements:org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates)
org.jetbrains.kotlin.backend.common.serialization.proto.CoordinatesOrBuilder {
// Construct using org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates.newBuilder()
// @@protoc_insertion_point(builder_implements:org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature)
org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignatureOrBuilder {
// Construct using org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
@@ -269,9 +269,9 @@ public final class Coordinates extends
public Builder clear() {
super.clear();
startOffset_ = 0;
container_ = 0;
bitField0_ = (bitField0_ & ~0x00000001);
endOffset_ = 0;
localId_ = 0L;
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
@@ -280,41 +280,41 @@ public final class Coordinates extends
return create().mergeFrom(buildPartial());
}
public org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates getDefaultInstanceForType() {
return org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates.getDefaultInstance();
public org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature getDefaultInstanceForType() {
return org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature.getDefaultInstance();
}
public org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates build() {
org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates result = buildPartial();
public org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature build() {
org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates buildPartial() {
org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates result = new org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates(this);
public org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature buildPartial() {
org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature result = new org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.startOffset_ = startOffset_;
result.container_ = container_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.endOffset_ = endOffset_;
result.localId_ = localId_;
result.bitField0_ = to_bitField0_;
return result;
}
public Builder mergeFrom(org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates other) {
if (other == org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates.getDefaultInstance()) return this;
if (other.hasStartOffset()) {
setStartOffset(other.getStartOffset());
public Builder mergeFrom(org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature other) {
if (other == org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature.getDefaultInstance()) return this;
if (other.hasContainer()) {
setContainer(other.getContainer());
}
if (other.hasEndOffset()) {
setEndOffset(other.getEndOffset());
if (other.hasLocalId()) {
setLocalId(other.getLocalId());
}
setUnknownFields(
getUnknownFields().concat(other.unknownFields));
@@ -322,11 +322,11 @@ public final class Coordinates extends
}
public final boolean isInitialized() {
if (!hasStartOffset()) {
if (!hasContainer()) {
return false;
}
if (!hasEndOffset()) {
if (!hasLocalId()) {
return false;
}
@@ -337,11 +337,11 @@ public final class Coordinates extends
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates parsedMessage = null;
org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates) e.getUnfinishedMessage();
parsedMessage = (org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
@@ -352,77 +352,77 @@ public final class Coordinates extends
}
private int bitField0_;
private int startOffset_ ;
private int container_ ;
/**
* <code>required int32 start_offset = 1;</code>
* <code>required int32 container = 1;</code>
*/
public boolean hasStartOffset() {
public boolean hasContainer() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int32 start_offset = 1;</code>
* <code>required int32 container = 1;</code>
*/
public int getStartOffset() {
return startOffset_;
public int getContainer() {
return container_;
}
/**
* <code>required int32 start_offset = 1;</code>
* <code>required int32 container = 1;</code>
*/
public Builder setStartOffset(int value) {
public Builder setContainer(int value) {
bitField0_ |= 0x00000001;
startOffset_ = value;
container_ = value;
return this;
}
/**
* <code>required int32 start_offset = 1;</code>
* <code>required int32 container = 1;</code>
*/
public Builder clearStartOffset() {
public Builder clearContainer() {
bitField0_ = (bitField0_ & ~0x00000001);
startOffset_ = 0;
container_ = 0;
return this;
}
private int endOffset_ ;
private long localId_ ;
/**
* <code>required int32 end_offset = 2;</code>
* <code>required int64 local_id = 2;</code>
*/
public boolean hasEndOffset() {
public boolean hasLocalId() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required int32 end_offset = 2;</code>
* <code>required int64 local_id = 2;</code>
*/
public int getEndOffset() {
return endOffset_;
public long getLocalId() {
return localId_;
}
/**
* <code>required int32 end_offset = 2;</code>
* <code>required int64 local_id = 2;</code>
*/
public Builder setEndOffset(int value) {
public Builder setLocalId(long value) {
bitField0_ |= 0x00000002;
endOffset_ = value;
localId_ = value;
return this;
}
/**
* <code>required int32 end_offset = 2;</code>
* <code>required int64 local_id = 2;</code>
*/
public Builder clearEndOffset() {
public Builder clearLocalId() {
bitField0_ = (bitField0_ & ~0x00000002);
endOffset_ = 0;
localId_ = 0L;
return this;
}
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates)
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature)
}
static {
defaultInstance = new Coordinates(true);
defaultInstance = new FileLocalIdSignature(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates)
// @@protoc_insertion_point(class_scope:org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature)
}
@@ -0,0 +1,27 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: compiler/ir/serialization.common/src/KotlinIr.proto
package org.jetbrains.kotlin.backend.common.serialization.proto;
public interface FileLocalIdSignatureOrBuilder extends
// @@protoc_insertion_point(interface_extends:org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature)
org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder {
/**
* <code>required int32 container = 1;</code>
*/
boolean hasContainer();
/**
* <code>required int32 container = 1;</code>
*/
int getContainer();
/**
* <code>required int64 local_id = 2;</code>
*/
boolean hasLocalId();
/**
* <code>required int64 local_id = 2;</code>
*/
long getLocalId();
}
@@ -0,0 +1,753 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: compiler/ir/serialization.common/src/KotlinIr.proto
package org.jetbrains.kotlin.backend.common.serialization.proto;
/**
* Protobuf type {@code org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature}
*/
public final class IdSignature extends
org.jetbrains.kotlin.protobuf.GeneratedMessageLite implements
// @@protoc_insertion_point(message_implements:org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature)
IdSignatureOrBuilder {
// Use IdSignature.newBuilder() to construct.
private IdSignature(org.jetbrains.kotlin.protobuf.GeneratedMessageLite.Builder builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private IdSignature(boolean noInit) { this.unknownFields = org.jetbrains.kotlin.protobuf.ByteString.EMPTY;}
private static final IdSignature defaultInstance;
public static IdSignature getDefaultInstance() {
return defaultInstance;
}
public IdSignature getDefaultInstanceForType() {
return defaultInstance;
}
private final org.jetbrains.kotlin.protobuf.ByteString unknownFields;
private IdSignature(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
org.jetbrains.kotlin.protobuf.ByteString.Output unknownFieldsOutput =
org.jetbrains.kotlin.protobuf.ByteString.newOutput();
org.jetbrains.kotlin.protobuf.CodedOutputStream unknownFieldsCodedOutput =
org.jetbrains.kotlin.protobuf.CodedOutputStream.newInstance(
unknownFieldsOutput, 1);
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFieldsCodedOutput,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature.Builder subBuilder = null;
if (idsigCase_ == 1) {
subBuilder = ((org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature) idsig_).toBuilder();
}
idsig_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom((org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature) idsig_);
idsig_ = subBuilder.buildPartial();
}
idsigCase_ = 1;
break;
}
case 18: {
org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature.Builder subBuilder = null;
if (idsigCase_ == 2) {
subBuilder = ((org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature) idsig_).toBuilder();
}
idsig_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom((org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature) idsig_);
idsig_ = subBuilder.buildPartial();
}
idsigCase_ = 2;
break;
}
case 26: {
org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature.Builder subBuilder = null;
if (idsigCase_ == 3) {
subBuilder = ((org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature) idsig_).toBuilder();
}
idsig_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom((org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature) idsig_);
idsig_ = subBuilder.buildPartial();
}
idsigCase_ = 3;
break;
}
case 32: {
idsigCase_ = 4;
idsig_ = input.readInt32();
break;
}
}
}
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
try {
unknownFieldsCodedOutput.flush();
} catch (java.io.IOException e) {
// Should not happen
} finally {
unknownFields = unknownFieldsOutput.toByteString();
}
makeExtensionsImmutable();
}
}
public static org.jetbrains.kotlin.protobuf.Parser<IdSignature> PARSER =
new org.jetbrains.kotlin.protobuf.AbstractParser<IdSignature>() {
public IdSignature parsePartialFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return new IdSignature(input, extensionRegistry);
}
};
@java.lang.Override
public org.jetbrains.kotlin.protobuf.Parser<IdSignature> getParserForType() {
return PARSER;
}
private int bitField0_;
private int idsigCase_ = 0;
private java.lang.Object idsig_;
public enum IdsigCase
implements org.jetbrains.kotlin.protobuf.Internal.EnumLite {
PUBLIC_SIG(1),
PRIVATE_SIG(2),
ACCESSOR_SIG(3),
SCOPED_LOCAL_SIG(4),
IDSIG_NOT_SET(0);
private int value = 0;
private IdsigCase(int value) {
this.value = value;
}
public static IdsigCase valueOf(int value) {
switch (value) {
case 1: return PUBLIC_SIG;
case 2: return PRIVATE_SIG;
case 3: return ACCESSOR_SIG;
case 4: return SCOPED_LOCAL_SIG;
case 0: return IDSIG_NOT_SET;
default: throw new java.lang.IllegalArgumentException(
"Value is undefined for this oneof enum.");
}
}
public int getNumber() {
return this.value;
}
};
public IdsigCase
getIdsigCase() {
return IdsigCase.valueOf(
idsigCase_);
}
public static final int PUBLIC_SIG_FIELD_NUMBER = 1;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature public_sig = 1;</code>
*/
public boolean hasPublicSig() {
return idsigCase_ == 1;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature public_sig = 1;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature getPublicSig() {
if (idsigCase_ == 1) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature) idsig_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature.getDefaultInstance();
}
public static final int PRIVATE_SIG_FIELD_NUMBER = 2;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature private_sig = 2;</code>
*/
public boolean hasPrivateSig() {
return idsigCase_ == 2;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature private_sig = 2;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature getPrivateSig() {
if (idsigCase_ == 2) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature) idsig_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature.getDefaultInstance();
}
public static final int ACCESSOR_SIG_FIELD_NUMBER = 3;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature accessor_sig = 3;</code>
*/
public boolean hasAccessorSig() {
return idsigCase_ == 3;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature accessor_sig = 3;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature getAccessorSig() {
if (idsigCase_ == 3) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature) idsig_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature.getDefaultInstance();
}
public static final int SCOPED_LOCAL_SIG_FIELD_NUMBER = 4;
/**
* <code>optional int32 scoped_local_sig = 4;</code>
*/
public boolean hasScopedLocalSig() {
return idsigCase_ == 4;
}
/**
* <code>optional int32 scoped_local_sig = 4;</code>
*/
public int getScopedLocalSig() {
if (idsigCase_ == 4) {
return (java.lang.Integer) idsig_;
}
return 0;
}
private void initFields() {
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (hasPrivateSig()) {
if (!getPrivateSig().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
if (hasAccessorSig()) {
if (!getAccessorSig().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(org.jetbrains.kotlin.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (idsigCase_ == 1) {
output.writeMessage(1, (org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature) idsig_);
}
if (idsigCase_ == 2) {
output.writeMessage(2, (org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature) idsig_);
}
if (idsigCase_ == 3) {
output.writeMessage(3, (org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature) idsig_);
}
if (idsigCase_ == 4) {
output.writeInt32(
4, (int)((java.lang.Integer) idsig_));
}
output.writeRawBytes(unknownFields);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (idsigCase_ == 1) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(1, (org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature) idsig_);
}
if (idsigCase_ == 2) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(2, (org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature) idsig_);
}
if (idsigCase_ == 3) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(3, (org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature) idsig_);
}
if (idsigCase_ == 4) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(
4, (int)((java.lang.Integer) idsig_));
}
size += unknownFields.size();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature parseFrom(
org.jetbrains.kotlin.protobuf.ByteString data)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature parseFrom(
org.jetbrains.kotlin.protobuf.ByteString data,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature parseFrom(byte[] data)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature parseFrom(
byte[] data,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature parseFrom(
java.io.InputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature parseDelimitedFrom(
java.io.InputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature parseFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature parseFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
/**
* Protobuf type {@code org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature}
*/
public static final class Builder extends
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.Builder<
org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature, Builder>
implements
// @@protoc_insertion_point(builder_implements:org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature)
org.jetbrains.kotlin.backend.common.serialization.proto.IdSignatureOrBuilder {
// Construct using org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
idsigCase_ = 0;
idsig_ = null;
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature getDefaultInstanceForType() {
return org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature.getDefaultInstance();
}
public org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature build() {
org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature buildPartial() {
org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature result = new org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (idsigCase_ == 1) {
result.idsig_ = idsig_;
}
if (idsigCase_ == 2) {
result.idsig_ = idsig_;
}
if (idsigCase_ == 3) {
result.idsig_ = idsig_;
}
if (idsigCase_ == 4) {
result.idsig_ = idsig_;
}
result.bitField0_ = to_bitField0_;
result.idsigCase_ = idsigCase_;
return result;
}
public Builder mergeFrom(org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature other) {
if (other == org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature.getDefaultInstance()) return this;
switch (other.getIdsigCase()) {
case PUBLIC_SIG: {
mergePublicSig(other.getPublicSig());
break;
}
case PRIVATE_SIG: {
mergePrivateSig(other.getPrivateSig());
break;
}
case ACCESSOR_SIG: {
mergeAccessorSig(other.getAccessorSig());
break;
}
case SCOPED_LOCAL_SIG: {
setScopedLocalSig(other.getScopedLocalSig());
break;
}
case IDSIG_NOT_SET: {
break;
}
}
setUnknownFields(
getUnknownFields().concat(other.unknownFields));
return this;
}
public final boolean isInitialized() {
if (hasPrivateSig()) {
if (!getPrivateSig().isInitialized()) {
return false;
}
}
if (hasAccessorSig()) {
if (!getAccessorSig().isInitialized()) {
return false;
}
}
return true;
}
public Builder mergeFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int idsigCase_ = 0;
private java.lang.Object idsig_;
public IdsigCase
getIdsigCase() {
return IdsigCase.valueOf(
idsigCase_);
}
public Builder clearIdsig() {
idsigCase_ = 0;
idsig_ = null;
return this;
}
private int bitField0_;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature public_sig = 1;</code>
*/
public boolean hasPublicSig() {
return idsigCase_ == 1;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature public_sig = 1;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature getPublicSig() {
if (idsigCase_ == 1) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature) idsig_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature.getDefaultInstance();
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature public_sig = 1;</code>
*/
public Builder setPublicSig(org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature value) {
if (value == null) {
throw new NullPointerException();
}
idsig_ = value;
idsigCase_ = 1;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature public_sig = 1;</code>
*/
public Builder setPublicSig(
org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature.Builder builderForValue) {
idsig_ = builderForValue.build();
idsigCase_ = 1;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature public_sig = 1;</code>
*/
public Builder mergePublicSig(org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature value) {
if (idsigCase_ == 1 &&
idsig_ != org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature.getDefaultInstance()) {
idsig_ = org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature.newBuilder((org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature) idsig_)
.mergeFrom(value).buildPartial();
} else {
idsig_ = value;
}
idsigCase_ = 1;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature public_sig = 1;</code>
*/
public Builder clearPublicSig() {
if (idsigCase_ == 1) {
idsigCase_ = 0;
idsig_ = null;
}
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature private_sig = 2;</code>
*/
public boolean hasPrivateSig() {
return idsigCase_ == 2;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature private_sig = 2;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature getPrivateSig() {
if (idsigCase_ == 2) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature) idsig_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature.getDefaultInstance();
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature private_sig = 2;</code>
*/
public Builder setPrivateSig(org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature value) {
if (value == null) {
throw new NullPointerException();
}
idsig_ = value;
idsigCase_ = 2;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature private_sig = 2;</code>
*/
public Builder setPrivateSig(
org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature.Builder builderForValue) {
idsig_ = builderForValue.build();
idsigCase_ = 2;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature private_sig = 2;</code>
*/
public Builder mergePrivateSig(org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature value) {
if (idsigCase_ == 2 &&
idsig_ != org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature.getDefaultInstance()) {
idsig_ = org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature.newBuilder((org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature) idsig_)
.mergeFrom(value).buildPartial();
} else {
idsig_ = value;
}
idsigCase_ = 2;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature private_sig = 2;</code>
*/
public Builder clearPrivateSig() {
if (idsigCase_ == 2) {
idsigCase_ = 0;
idsig_ = null;
}
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature accessor_sig = 3;</code>
*/
public boolean hasAccessorSig() {
return idsigCase_ == 3;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature accessor_sig = 3;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature getAccessorSig() {
if (idsigCase_ == 3) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature) idsig_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature.getDefaultInstance();
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature accessor_sig = 3;</code>
*/
public Builder setAccessorSig(org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature value) {
if (value == null) {
throw new NullPointerException();
}
idsig_ = value;
idsigCase_ = 3;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature accessor_sig = 3;</code>
*/
public Builder setAccessorSig(
org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature.Builder builderForValue) {
idsig_ = builderForValue.build();
idsigCase_ = 3;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature accessor_sig = 3;</code>
*/
public Builder mergeAccessorSig(org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature value) {
if (idsigCase_ == 3 &&
idsig_ != org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature.getDefaultInstance()) {
idsig_ = org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature.newBuilder((org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature) idsig_)
.mergeFrom(value).buildPartial();
} else {
idsig_ = value;
}
idsigCase_ = 3;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature accessor_sig = 3;</code>
*/
public Builder clearAccessorSig() {
if (idsigCase_ == 3) {
idsigCase_ = 0;
idsig_ = null;
}
return this;
}
/**
* <code>optional int32 scoped_local_sig = 4;</code>
*/
public boolean hasScopedLocalSig() {
return idsigCase_ == 4;
}
/**
* <code>optional int32 scoped_local_sig = 4;</code>
*/
public int getScopedLocalSig() {
if (idsigCase_ == 4) {
return (java.lang.Integer) idsig_;
}
return 0;
}
/**
* <code>optional int32 scoped_local_sig = 4;</code>
*/
public Builder setScopedLocalSig(int value) {
idsigCase_ = 4;
idsig_ = value;
return this;
}
/**
* <code>optional int32 scoped_local_sig = 4;</code>
*/
public Builder clearScopedLocalSig() {
if (idsigCase_ == 4) {
idsigCase_ = 0;
idsig_ = null;
}
return this;
}
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature)
}
static {
defaultInstance = new IdSignature(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature)
}
@@ -0,0 +1,45 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: compiler/ir/serialization.common/src/KotlinIr.proto
package org.jetbrains.kotlin.backend.common.serialization.proto;
public interface IdSignatureOrBuilder extends
// @@protoc_insertion_point(interface_extends:org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature)
org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder {
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature public_sig = 1;</code>
*/
boolean hasPublicSig();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature public_sig = 1;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature getPublicSig();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature private_sig = 2;</code>
*/
boolean hasPrivateSig();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature private_sig = 2;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.FileLocalIdSignature getPrivateSig();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature accessor_sig = 3;</code>
*/
boolean hasAccessorSig();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature accessor_sig = 3;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature getAccessorSig();
/**
* <code>optional int32 scoped_local_sig = 4;</code>
*/
boolean hasScopedLocalSig();
/**
* <code>optional int32 scoped_local_sig = 4;</code>
*/
int getScopedLocalSig();
}
@@ -54,26 +54,18 @@ public final class IrBlock extends
break;
}
case 10: {
org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.Builder subBuilder = null;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
subBuilder = origin_.toBuilder();
}
origin_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(origin_);
origin_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000001;
break;
}
case 18: {
if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
statement_ = new java.util.ArrayList<org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement>();
mutable_bitField0_ |= 0x00000002;
mutable_bitField0_ |= 0x00000001;
}
statement_.add(input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement.PARSER, extensionRegistry));
break;
}
case 16: {
bitField0_ |= 0x00000001;
originName_ = input.readInt32();
break;
}
}
}
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
@@ -82,7 +74,7 @@ public final class IrBlock extends
throw new org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
statement_ = java.util.Collections.unmodifiableList(statement_);
}
try {
@@ -111,59 +103,59 @@ public final class IrBlock extends
}
private int bitField0_;
public static final int ORIGIN_FIELD_NUMBER = 1;
private org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin_;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 1;</code>
*/
public boolean hasOrigin() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 1;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin getOrigin() {
return origin_;
}
public static final int STATEMENT_FIELD_NUMBER = 2;
public static final int STATEMENT_FIELD_NUMBER = 1;
private java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement> statement_;
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 2;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 1;</code>
*/
public java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement> getStatementList() {
return statement_;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 2;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 1;</code>
*/
public java.util.List<? extends org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrBuilder>
getStatementOrBuilderList() {
return statement_;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 2;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 1;</code>
*/
public int getStatementCount() {
return statement_.size();
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 2;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 1;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement getStatement(int index) {
return statement_.get(index);
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 2;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 1;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrBuilder getStatementOrBuilder(
int index) {
return statement_.get(index);
}
public static final int ORIGIN_NAME_FIELD_NUMBER = 2;
private int originName_;
/**
* <code>optional int32 origin_name = 2;</code>
*/
public boolean hasOriginName() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>optional int32 origin_name = 2;</code>
*/
public int getOriginName() {
return originName_;
}
private void initFields() {
origin_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.getDefaultInstance();
statement_ = java.util.Collections.emptyList();
originName_ = 0;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
@@ -171,12 +163,6 @@ public final class IrBlock extends
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (hasOrigin()) {
if (!getOrigin().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
for (int i = 0; i < getStatementCount(); i++) {
if (!getStatement(i).isInitialized()) {
memoizedIsInitialized = 0;
@@ -190,11 +176,11 @@ public final class IrBlock extends
public void writeTo(org.jetbrains.kotlin.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeMessage(1, origin_);
}
for (int i = 0; i < statement_.size(); i++) {
output.writeMessage(2, statement_.get(i));
output.writeMessage(1, statement_.get(i));
}
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeInt32(2, originName_);
}
output.writeRawBytes(unknownFields);
}
@@ -205,13 +191,13 @@ public final class IrBlock extends
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(1, origin_);
}
for (int i = 0; i < statement_.size(); i++) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(2, statement_.get(i));
.computeMessageSize(1, statement_.get(i));
}
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(2, originName_);
}
size += unknownFields.size();
memoizedSerializedSize = size;
@@ -307,9 +293,9 @@ public final class IrBlock extends
public Builder clear() {
super.clear();
origin_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000001);
statement_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
originName_ = 0;
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
@@ -334,46 +320,40 @@ public final class IrBlock extends
org.jetbrains.kotlin.backend.common.serialization.proto.IrBlock result = new org.jetbrains.kotlin.backend.common.serialization.proto.IrBlock(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.origin_ = origin_;
if (((bitField0_ & 0x00000002) == 0x00000002)) {
if (((bitField0_ & 0x00000001) == 0x00000001)) {
statement_ = java.util.Collections.unmodifiableList(statement_);
bitField0_ = (bitField0_ & ~0x00000002);
bitField0_ = (bitField0_ & ~0x00000001);
}
result.statement_ = statement_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000001;
}
result.originName_ = originName_;
result.bitField0_ = to_bitField0_;
return result;
}
public Builder mergeFrom(org.jetbrains.kotlin.backend.common.serialization.proto.IrBlock other) {
if (other == org.jetbrains.kotlin.backend.common.serialization.proto.IrBlock.getDefaultInstance()) return this;
if (other.hasOrigin()) {
mergeOrigin(other.getOrigin());
}
if (!other.statement_.isEmpty()) {
if (statement_.isEmpty()) {
statement_ = other.statement_;
bitField0_ = (bitField0_ & ~0x00000002);
bitField0_ = (bitField0_ & ~0x00000001);
} else {
ensureStatementIsMutable();
statement_.addAll(other.statement_);
}
}
if (other.hasOriginName()) {
setOriginName(other.getOriginName());
}
setUnknownFields(
getUnknownFields().concat(other.unknownFields));
return this;
}
public final boolean isInitialized() {
if (hasOrigin()) {
if (!getOrigin().isInitialized()) {
return false;
}
}
for (int i = 0; i < getStatementCount(); i++) {
if (!getStatement(i).isInitialized()) {
@@ -402,95 +382,35 @@ public final class IrBlock extends
}
private int bitField0_;
private org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.getDefaultInstance();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 1;</code>
*/
public boolean hasOrigin() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 1;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin getOrigin() {
return origin_;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 1;</code>
*/
public Builder setOrigin(org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin value) {
if (value == null) {
throw new NullPointerException();
}
origin_ = value;
bitField0_ |= 0x00000001;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 1;</code>
*/
public Builder setOrigin(
org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.Builder builderForValue) {
origin_ = builderForValue.build();
bitField0_ |= 0x00000001;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 1;</code>
*/
public Builder mergeOrigin(org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin value) {
if (((bitField0_ & 0x00000001) == 0x00000001) &&
origin_ != org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.getDefaultInstance()) {
origin_ =
org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.newBuilder(origin_).mergeFrom(value).buildPartial();
} else {
origin_ = value;
}
bitField0_ |= 0x00000001;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 1;</code>
*/
public Builder clearOrigin() {
origin_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000001);
return this;
}
private java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement> statement_ =
java.util.Collections.emptyList();
private void ensureStatementIsMutable() {
if (!((bitField0_ & 0x00000002) == 0x00000002)) {
if (!((bitField0_ & 0x00000001) == 0x00000001)) {
statement_ = new java.util.ArrayList<org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement>(statement_);
bitField0_ |= 0x00000002;
bitField0_ |= 0x00000001;
}
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 2;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 1;</code>
*/
public java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement> getStatementList() {
return java.util.Collections.unmodifiableList(statement_);
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 2;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 1;</code>
*/
public int getStatementCount() {
return statement_.size();
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 2;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 1;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement getStatement(int index) {
return statement_.get(index);
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 2;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 1;</code>
*/
public Builder setStatement(
int index, org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement value) {
@@ -503,7 +423,7 @@ public final class IrBlock extends
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 2;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 1;</code>
*/
public Builder setStatement(
int index, org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement.Builder builderForValue) {
@@ -513,7 +433,7 @@ public final class IrBlock extends
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 2;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 1;</code>
*/
public Builder addStatement(org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement value) {
if (value == null) {
@@ -525,7 +445,7 @@ public final class IrBlock extends
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 2;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 1;</code>
*/
public Builder addStatement(
int index, org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement value) {
@@ -538,7 +458,7 @@ public final class IrBlock extends
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 2;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 1;</code>
*/
public Builder addStatement(
org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement.Builder builderForValue) {
@@ -548,7 +468,7 @@ public final class IrBlock extends
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 2;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 1;</code>
*/
public Builder addStatement(
int index, org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement.Builder builderForValue) {
@@ -558,7 +478,7 @@ public final class IrBlock extends
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 2;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 1;</code>
*/
public Builder addAllStatement(
java.lang.Iterable<? extends org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement> values) {
@@ -569,16 +489,16 @@ public final class IrBlock extends
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 2;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 1;</code>
*/
public Builder clearStatement() {
statement_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000002);
bitField0_ = (bitField0_ & ~0x00000001);
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 2;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 1;</code>
*/
public Builder removeStatement(int index) {
ensureStatementIsMutable();
@@ -587,6 +507,38 @@ public final class IrBlock extends
return this;
}
private int originName_ ;
/**
* <code>optional int32 origin_name = 2;</code>
*/
public boolean hasOriginName() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>optional int32 origin_name = 2;</code>
*/
public int getOriginName() {
return originName_;
}
/**
* <code>optional int32 origin_name = 2;</code>
*/
public Builder setOriginName(int value) {
bitField0_ |= 0x00000002;
originName_ = value;
return this;
}
/**
* <code>optional int32 origin_name = 2;</code>
*/
public Builder clearOriginName() {
bitField0_ = (bitField0_ & ~0x00000002);
originName_ = 0;
return this;
}
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.backend.common.serialization.proto.IrBlock)
}
@@ -8,25 +8,25 @@ public interface IrBlockOrBuilder extends
org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder {
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 1;</code>
*/
boolean hasOrigin();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 1;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin getOrigin();
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 2;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 1;</code>
*/
java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement>
getStatementList();
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 2;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 1;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement getStatement(int index);
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 2;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement statement = 1;</code>
*/
int getStatementCount();
/**
* <code>optional int32 origin_name = 2;</code>
*/
boolean hasOriginName();
/**
* <code>optional int32 origin_name = 2;</code>
*/
int getOriginName();
}
@@ -55,7 +55,7 @@ public final class IrCall extends
}
case 8: {
bitField0_ |= 0x00000001;
symbol_ = input.readInt32();
symbol_ = input.readInt64();
break;
}
case 18: {
@@ -73,20 +73,12 @@ public final class IrCall extends
}
case 24: {
bitField0_ |= 0x00000004;
super_ = input.readInt32();
super_ = input.readInt64();
break;
}
case 34: {
org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.Builder subBuilder = null;
if (((bitField0_ & 0x00000008) == 0x00000008)) {
subBuilder = origin_.toBuilder();
}
origin_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(origin_);
origin_ = subBuilder.buildPartial();
}
case 32: {
bitField0_ |= 0x00000008;
originName_ = input.readInt32();
break;
}
}
@@ -124,17 +116,17 @@ public final class IrCall extends
private int bitField0_;
public static final int SYMBOL_FIELD_NUMBER = 1;
private int symbol_;
private long symbol_;
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public boolean hasSymbol() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public int getSymbol() {
public long getSymbol() {
return symbol_;
}
@@ -154,40 +146,40 @@ public final class IrCall extends
}
public static final int SUPER_FIELD_NUMBER = 3;
private int super_;
private long super_;
/**
* <code>optional int32 super = 3;</code>
* <code>optional int64 super = 3;</code>
*/
public boolean hasSuper() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>optional int32 super = 3;</code>
* <code>optional int64 super = 3;</code>
*/
public int getSuper() {
public long getSuper() {
return super_;
}
public static final int ORIGIN_FIELD_NUMBER = 4;
private org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin_;
public static final int ORIGIN_NAME_FIELD_NUMBER = 4;
private int originName_;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 4;</code>
* <code>optional int32 origin_name = 4;</code>
*/
public boolean hasOrigin() {
public boolean hasOriginName() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 4;</code>
* <code>optional int32 origin_name = 4;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin getOrigin() {
return origin_;
public int getOriginName() {
return originName_;
}
private void initFields() {
symbol_ = 0;
symbol_ = 0L;
memberAccess_ = org.jetbrains.kotlin.backend.common.serialization.proto.MemberAccessCommon.getDefaultInstance();
super_ = 0;
origin_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.getDefaultInstance();
super_ = 0L;
originName_ = 0;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
@@ -207,12 +199,6 @@ public final class IrCall extends
memoizedIsInitialized = 0;
return false;
}
if (hasOrigin()) {
if (!getOrigin().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
@@ -221,16 +207,16 @@ public final class IrCall extends
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeInt32(1, symbol_);
output.writeInt64(1, symbol_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeMessage(2, memberAccess_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeInt32(3, super_);
output.writeInt64(3, super_);
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
output.writeMessage(4, origin_);
output.writeInt32(4, originName_);
}
output.writeRawBytes(unknownFields);
}
@@ -243,7 +229,7 @@ public final class IrCall extends
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(1, symbol_);
.computeInt64Size(1, symbol_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
@@ -251,11 +237,11 @@ public final class IrCall extends
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(3, super_);
.computeInt64Size(3, super_);
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(4, origin_);
.computeInt32Size(4, originName_);
}
size += unknownFields.size();
memoizedSerializedSize = size;
@@ -351,13 +337,13 @@ public final class IrCall extends
public Builder clear() {
super.clear();
symbol_ = 0;
symbol_ = 0L;
bitField0_ = (bitField0_ & ~0x00000001);
memberAccess_ = org.jetbrains.kotlin.backend.common.serialization.proto.MemberAccessCommon.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000002);
super_ = 0;
super_ = 0L;
bitField0_ = (bitField0_ & ~0x00000004);
origin_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.getDefaultInstance();
originName_ = 0;
bitField0_ = (bitField0_ & ~0x00000008);
return this;
}
@@ -397,7 +383,7 @@ public final class IrCall extends
if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
to_bitField0_ |= 0x00000008;
}
result.origin_ = origin_;
result.originName_ = originName_;
result.bitField0_ = to_bitField0_;
return result;
}
@@ -413,8 +399,8 @@ public final class IrCall extends
if (other.hasSuper()) {
setSuper(other.getSuper());
}
if (other.hasOrigin()) {
mergeOrigin(other.getOrigin());
if (other.hasOriginName()) {
setOriginName(other.getOriginName());
}
setUnknownFields(
getUnknownFields().concat(other.unknownFields));
@@ -434,12 +420,6 @@ public final class IrCall extends
return false;
}
if (hasOrigin()) {
if (!getOrigin().isInitialized()) {
return false;
}
}
return true;
}
@@ -462,34 +442,34 @@ public final class IrCall extends
}
private int bitField0_;
private int symbol_ ;
private long symbol_ ;
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public boolean hasSymbol() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public int getSymbol() {
public long getSymbol() {
return symbol_;
}
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public Builder setSymbol(int value) {
public Builder setSymbol(long value) {
bitField0_ |= 0x00000001;
symbol_ = value;
return this;
}
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public Builder clearSymbol() {
bitField0_ = (bitField0_ & ~0x00000001);
symbol_ = 0;
symbol_ = 0L;
return this;
}
@@ -554,95 +534,67 @@ public final class IrCall extends
return this;
}
private int super_ ;
private long super_ ;
/**
* <code>optional int32 super = 3;</code>
* <code>optional int64 super = 3;</code>
*/
public boolean hasSuper() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>optional int32 super = 3;</code>
* <code>optional int64 super = 3;</code>
*/
public int getSuper() {
public long getSuper() {
return super_;
}
/**
* <code>optional int32 super = 3;</code>
* <code>optional int64 super = 3;</code>
*/
public Builder setSuper(int value) {
public Builder setSuper(long value) {
bitField0_ |= 0x00000004;
super_ = value;
return this;
}
/**
* <code>optional int32 super = 3;</code>
* <code>optional int64 super = 3;</code>
*/
public Builder clearSuper() {
bitField0_ = (bitField0_ & ~0x00000004);
super_ = 0;
super_ = 0L;
return this;
}
private org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.getDefaultInstance();
private int originName_ ;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 4;</code>
* <code>optional int32 origin_name = 4;</code>
*/
public boolean hasOrigin() {
public boolean hasOriginName() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 4;</code>
* <code>optional int32 origin_name = 4;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin getOrigin() {
return origin_;
public int getOriginName() {
return originName_;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 4;</code>
* <code>optional int32 origin_name = 4;</code>
*/
public Builder setOrigin(org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin value) {
if (value == null) {
throw new NullPointerException();
}
origin_ = value;
public Builder setOriginName(int value) {
bitField0_ |= 0x00000008;
originName_ = value;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 4;</code>
* <code>optional int32 origin_name = 4;</code>
*/
public Builder setOrigin(
org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.Builder builderForValue) {
origin_ = builderForValue.build();
bitField0_ |= 0x00000008;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 4;</code>
*/
public Builder mergeOrigin(org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin value) {
if (((bitField0_ & 0x00000008) == 0x00000008) &&
origin_ != org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.getDefaultInstance()) {
origin_ =
org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.newBuilder(origin_).mergeFrom(value).buildPartial();
} else {
origin_ = value;
}
bitField0_ |= 0x00000008;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 4;</code>
*/
public Builder clearOrigin() {
origin_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.getDefaultInstance();
public Builder clearOriginName() {
bitField0_ = (bitField0_ & ~0x00000008);
originName_ = 0;
return this;
}
@@ -8,13 +8,13 @@ public interface IrCallOrBuilder extends
org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder {
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
boolean hasSymbol();
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
int getSymbol();
long getSymbol();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.MemberAccessCommon member_access = 2;</code>
@@ -26,20 +26,20 @@ public interface IrCallOrBuilder extends
org.jetbrains.kotlin.backend.common.serialization.proto.MemberAccessCommon getMemberAccess();
/**
* <code>optional int32 super = 3;</code>
* <code>optional int64 super = 3;</code>
*/
boolean hasSuper();
/**
* <code>optional int32 super = 3;</code>
* <code>optional int64 super = 3;</code>
*/
int getSuper();
long getSuper();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 4;</code>
* <code>optional int32 origin_name = 4;</code>
*/
boolean hasOrigin();
boolean hasOriginName();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 4;</code>
* <code>optional int32 origin_name = 4;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin getOrigin();
int getOriginName();
}
@@ -26,140 +26,52 @@ public interface IrClassOrBuilder extends
int getName();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.ClassKind kind = 3;</code>
*/
boolean hasKind();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.ClassKind kind = 3;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.ClassKind getKind();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Visibility visibility = 4;</code>
*/
boolean hasVisibility();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Visibility visibility = 4;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.Visibility getVisibility();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.ModalityKind modality = 5;</code>
*/
boolean hasModality();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.ModalityKind modality = 5;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.ModalityKind getModality();
/**
* <code>required bool is_companion = 6;</code>
*
* <pre>
* TODO: consider using flags for the booleans.
* </pre>
*/
boolean hasIsCompanion();
/**
* <code>required bool is_companion = 6;</code>
*
* <pre>
* TODO: consider using flags for the booleans.
* </pre>
*/
boolean getIsCompanion();
/**
* <code>required bool is_inner = 7;</code>
*/
boolean hasIsInner();
/**
* <code>required bool is_inner = 7;</code>
*/
boolean getIsInner();
/**
* <code>required bool is_data = 8;</code>
*/
boolean hasIsData();
/**
* <code>required bool is_data = 8;</code>
*/
boolean getIsData();
/**
* <code>required bool is_external = 9;</code>
*/
boolean hasIsExternal();
/**
* <code>required bool is_external = 9;</code>
*/
boolean getIsExternal();
/**
* <code>required bool is_inline = 10;</code>
*/
boolean hasIsInline();
/**
* <code>required bool is_inline = 10;</code>
*/
boolean getIsInline();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter this_receiver = 11;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter this_receiver = 3;</code>
*/
boolean hasThisReceiver();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter this_receiver = 11;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter this_receiver = 3;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter getThisReceiver();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameterContainer type_parameters = 12;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter type_parameter = 4;</code>
*/
boolean hasTypeParameters();
java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter>
getTypeParameterList();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameterContainer type_parameters = 12;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter type_parameter = 4;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameterContainer getTypeParameters();
org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter getTypeParameter(int index);
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter type_parameter = 4;</code>
*/
int getTypeParameterCount();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer declaration_container = 13;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration declaration = 5;</code>
*/
boolean hasDeclarationContainer();
java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration>
getDeclarationList();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer declaration_container = 13;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration declaration = 5;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer getDeclarationContainer();
org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration getDeclaration(int index);
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration declaration = 5;</code>
*/
int getDeclarationCount();
/**
* <code>repeated int32 super_type = 14;</code>
* <code>repeated int32 super_type = 6 [packed = true];</code>
*/
java.util.List<java.lang.Integer> getSuperTypeList();
/**
* <code>repeated int32 super_type = 14;</code>
* <code>repeated int32 super_type = 6 [packed = true];</code>
*/
int getSuperTypeCount();
/**
* <code>repeated int32 super_type = 14;</code>
* <code>repeated int32 super_type = 6 [packed = true];</code>
*/
int getSuperType(int index);
/**
* <code>required bool is_expect = 15;</code>
*/
boolean hasIsExpect();
/**
* <code>required bool is_expect = 15;</code>
*/
boolean getIsExpect();
/**
* <code>required bool is_fun = 16;</code>
*/
boolean hasIsFun();
/**
* <code>required bool is_fun = 16;</code>
*/
boolean getIsFun();
}
@@ -55,7 +55,7 @@ public final class IrClassReference extends
}
case 8: {
bitField0_ |= 0x00000001;
classSymbol_ = input.readInt32();
classSymbol_ = input.readInt64();
break;
}
case 16: {
@@ -98,17 +98,17 @@ public final class IrClassReference extends
private int bitField0_;
public static final int CLASS_SYMBOL_FIELD_NUMBER = 1;
private int classSymbol_;
private long classSymbol_;
/**
* <code>required int32 class_symbol = 1;</code>
* <code>required int64 class_symbol = 1;</code>
*/
public boolean hasClassSymbol() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int32 class_symbol = 1;</code>
* <code>required int64 class_symbol = 1;</code>
*/
public int getClassSymbol() {
public long getClassSymbol() {
return classSymbol_;
}
@@ -128,7 +128,7 @@ public final class IrClassReference extends
}
private void initFields() {
classSymbol_ = 0;
classSymbol_ = 0L;
classType_ = 0;
}
private byte memoizedIsInitialized = -1;
@@ -153,7 +153,7 @@ public final class IrClassReference extends
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeInt32(1, classSymbol_);
output.writeInt64(1, classSymbol_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeInt32(2, classType_);
@@ -169,7 +169,7 @@ public final class IrClassReference extends
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(1, classSymbol_);
.computeInt64Size(1, classSymbol_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
@@ -269,7 +269,7 @@ public final class IrClassReference extends
public Builder clear() {
super.clear();
classSymbol_ = 0;
classSymbol_ = 0L;
bitField0_ = (bitField0_ & ~0x00000001);
classType_ = 0;
bitField0_ = (bitField0_ & ~0x00000002);
@@ -352,34 +352,34 @@ public final class IrClassReference extends
}
private int bitField0_;
private int classSymbol_ ;
private long classSymbol_ ;
/**
* <code>required int32 class_symbol = 1;</code>
* <code>required int64 class_symbol = 1;</code>
*/
public boolean hasClassSymbol() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int32 class_symbol = 1;</code>
* <code>required int64 class_symbol = 1;</code>
*/
public int getClassSymbol() {
public long getClassSymbol() {
return classSymbol_;
}
/**
* <code>required int32 class_symbol = 1;</code>
* <code>required int64 class_symbol = 1;</code>
*/
public Builder setClassSymbol(int value) {
public Builder setClassSymbol(long value) {
bitField0_ |= 0x00000001;
classSymbol_ = value;
return this;
}
/**
* <code>required int32 class_symbol = 1;</code>
* <code>required int64 class_symbol = 1;</code>
*/
public Builder clearClassSymbol() {
bitField0_ = (bitField0_ & ~0x00000001);
classSymbol_ = 0;
classSymbol_ = 0L;
return this;
}
@@ -8,13 +8,13 @@ public interface IrClassReferenceOrBuilder extends
org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder {
/**
* <code>required int32 class_symbol = 1;</code>
* <code>required int64 class_symbol = 1;</code>
*/
boolean hasClassSymbol();
/**
* <code>required int32 class_symbol = 1;</code>
* <code>required int64 class_symbol = 1;</code>
*/
int getClassSymbol();
long getClassSymbol();
/**
* <code>required int32 class_type = 2;</code>
@@ -61,17 +61,9 @@ public final class IrComposite extends
statement_.add(input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement.PARSER, extensionRegistry));
break;
}
case 18: {
org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.Builder subBuilder = null;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
subBuilder = origin_.toBuilder();
}
origin_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(origin_);
origin_ = subBuilder.buildPartial();
}
case 16: {
bitField0_ |= 0x00000001;
originName_ = input.readInt32();
break;
}
}
@@ -146,24 +138,24 @@ public final class IrComposite extends
return statement_.get(index);
}
public static final int ORIGIN_FIELD_NUMBER = 2;
private org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin_;
public static final int ORIGIN_NAME_FIELD_NUMBER = 2;
private int originName_;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 2;</code>
* <code>optional int32 origin_name = 2;</code>
*/
public boolean hasOrigin() {
public boolean hasOriginName() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 2;</code>
* <code>optional int32 origin_name = 2;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin getOrigin() {
return origin_;
public int getOriginName() {
return originName_;
}
private void initFields() {
statement_ = java.util.Collections.emptyList();
origin_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.getDefaultInstance();
originName_ = 0;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
@@ -177,12 +169,6 @@ public final class IrComposite extends
return false;
}
}
if (hasOrigin()) {
if (!getOrigin().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
@@ -194,7 +180,7 @@ public final class IrComposite extends
output.writeMessage(1, statement_.get(i));
}
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeMessage(2, origin_);
output.writeInt32(2, originName_);
}
output.writeRawBytes(unknownFields);
}
@@ -211,7 +197,7 @@ public final class IrComposite extends
}
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(2, origin_);
.computeInt32Size(2, originName_);
}
size += unknownFields.size();
memoizedSerializedSize = size;
@@ -309,7 +295,7 @@ public final class IrComposite extends
super.clear();
statement_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
origin_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.getDefaultInstance();
originName_ = 0;
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
@@ -342,7 +328,7 @@ public final class IrComposite extends
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000001;
}
result.origin_ = origin_;
result.originName_ = originName_;
result.bitField0_ = to_bitField0_;
return result;
}
@@ -359,8 +345,8 @@ public final class IrComposite extends
}
}
if (other.hasOrigin()) {
mergeOrigin(other.getOrigin());
if (other.hasOriginName()) {
setOriginName(other.getOriginName());
}
setUnknownFields(
getUnknownFields().concat(other.unknownFields));
@@ -374,12 +360,6 @@ public final class IrComposite extends
return false;
}
}
if (hasOrigin()) {
if (!getOrigin().isInitialized()) {
return false;
}
}
return true;
}
@@ -527,63 +507,35 @@ public final class IrComposite extends
return this;
}
private org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.getDefaultInstance();
private int originName_ ;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 2;</code>
* <code>optional int32 origin_name = 2;</code>
*/
public boolean hasOrigin() {
public boolean hasOriginName() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 2;</code>
* <code>optional int32 origin_name = 2;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin getOrigin() {
return origin_;
public int getOriginName() {
return originName_;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 2;</code>
* <code>optional int32 origin_name = 2;</code>
*/
public Builder setOrigin(org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin value) {
if (value == null) {
throw new NullPointerException();
}
origin_ = value;
public Builder setOriginName(int value) {
bitField0_ |= 0x00000002;
originName_ = value;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 2;</code>
* <code>optional int32 origin_name = 2;</code>
*/
public Builder setOrigin(
org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.Builder builderForValue) {
origin_ = builderForValue.build();
bitField0_ |= 0x00000002;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 2;</code>
*/
public Builder mergeOrigin(org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin value) {
if (((bitField0_ & 0x00000002) == 0x00000002) &&
origin_ != org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.getDefaultInstance()) {
origin_ =
org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.newBuilder(origin_).mergeFrom(value).buildPartial();
} else {
origin_ = value;
}
bitField0_ |= 0x00000002;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 2;</code>
*/
public Builder clearOrigin() {
origin_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.getDefaultInstance();
public Builder clearOriginName() {
bitField0_ = (bitField0_ & ~0x00000002);
originName_ = 0;
return this;
}
@@ -22,11 +22,11 @@ public interface IrCompositeOrBuilder extends
int getStatementCount();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 2;</code>
* <code>optional int32 origin_name = 2;</code>
*/
boolean hasOrigin();
boolean hasOriginName();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 2;</code>
* <code>optional int32 origin_name = 2;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin getOrigin();
int getOriginName();
}
@@ -66,11 +66,6 @@ public final class IrConstructor extends
bitField0_ |= 0x00000001;
break;
}
case 16: {
bitField0_ |= 0x00000002;
isPrimary_ = input.readBool();
break;
}
}
}
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
@@ -120,24 +115,8 @@ public final class IrConstructor extends
return base_;
}
public static final int IS_PRIMARY_FIELD_NUMBER = 2;
private boolean isPrimary_;
/**
* <code>required bool is_primary = 2;</code>
*/
public boolean hasIsPrimary() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required bool is_primary = 2;</code>
*/
public boolean getIsPrimary() {
return isPrimary_;
}
private void initFields() {
base_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrFunctionBase.getDefaultInstance();
isPrimary_ = false;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
@@ -149,10 +128,6 @@ public final class IrConstructor extends
memoizedIsInitialized = 0;
return false;
}
if (!hasIsPrimary()) {
memoizedIsInitialized = 0;
return false;
}
if (!getBase().isInitialized()) {
memoizedIsInitialized = 0;
return false;
@@ -167,9 +142,6 @@ public final class IrConstructor extends
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeMessage(1, base_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeBool(2, isPrimary_);
}
output.writeRawBytes(unknownFields);
}
@@ -183,10 +155,6 @@ public final class IrConstructor extends
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(1, base_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeBoolSize(2, isPrimary_);
}
size += unknownFields.size();
memoizedSerializedSize = size;
return size;
@@ -283,8 +251,6 @@ public final class IrConstructor extends
super.clear();
base_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrFunctionBase.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000001);
isPrimary_ = false;
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
@@ -312,10 +278,6 @@ public final class IrConstructor extends
to_bitField0_ |= 0x00000001;
}
result.base_ = base_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.isPrimary_ = isPrimary_;
result.bitField0_ = to_bitField0_;
return result;
}
@@ -325,9 +287,6 @@ public final class IrConstructor extends
if (other.hasBase()) {
mergeBase(other.getBase());
}
if (other.hasIsPrimary()) {
setIsPrimary(other.getIsPrimary());
}
setUnknownFields(
getUnknownFields().concat(other.unknownFields));
return this;
@@ -338,10 +297,6 @@ public final class IrConstructor extends
return false;
}
if (!hasIsPrimary()) {
return false;
}
if (!getBase().isInitialized()) {
return false;
@@ -428,38 +383,6 @@ public final class IrConstructor extends
return this;
}
private boolean isPrimary_ ;
/**
* <code>required bool is_primary = 2;</code>
*/
public boolean hasIsPrimary() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required bool is_primary = 2;</code>
*/
public boolean getIsPrimary() {
return isPrimary_;
}
/**
* <code>required bool is_primary = 2;</code>
*/
public Builder setIsPrimary(boolean value) {
bitField0_ |= 0x00000002;
isPrimary_ = value;
return this;
}
/**
* <code>required bool is_primary = 2;</code>
*/
public Builder clearIsPrimary() {
bitField0_ = (bitField0_ & ~0x00000002);
isPrimary_ = false;
return this;
}
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructor)
}
@@ -55,7 +55,7 @@ public final class IrConstructorCall extends
}
case 8: {
bitField0_ |= 0x00000001;
symbol_ = input.readInt32();
symbol_ = input.readInt64();
break;
}
case 16: {
@@ -111,17 +111,17 @@ public final class IrConstructorCall extends
private int bitField0_;
public static final int SYMBOL_FIELD_NUMBER = 1;
private int symbol_;
private long symbol_;
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public boolean hasSymbol() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public int getSymbol() {
public long getSymbol() {
return symbol_;
}
@@ -156,7 +156,7 @@ public final class IrConstructorCall extends
}
private void initFields() {
symbol_ = 0;
symbol_ = 0L;
constructorTypeArgumentsCount_ = 0;
memberAccess_ = org.jetbrains.kotlin.backend.common.serialization.proto.MemberAccessCommon.getDefaultInstance();
}
@@ -190,7 +190,7 @@ public final class IrConstructorCall extends
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeInt32(1, symbol_);
output.writeInt64(1, symbol_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeInt32(2, constructorTypeArgumentsCount_);
@@ -209,7 +209,7 @@ public final class IrConstructorCall extends
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(1, symbol_);
.computeInt64Size(1, symbol_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
@@ -313,7 +313,7 @@ public final class IrConstructorCall extends
public Builder clear() {
super.clear();
symbol_ = 0;
symbol_ = 0L;
bitField0_ = (bitField0_ & ~0x00000001);
constructorTypeArgumentsCount_ = 0;
bitField0_ = (bitField0_ & ~0x00000002);
@@ -413,34 +413,34 @@ public final class IrConstructorCall extends
}
private int bitField0_;
private int symbol_ ;
private long symbol_ ;
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public boolean hasSymbol() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public int getSymbol() {
public long getSymbol() {
return symbol_;
}
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public Builder setSymbol(int value) {
public Builder setSymbol(long value) {
bitField0_ |= 0x00000001;
symbol_ = value;
return this;
}
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public Builder clearSymbol() {
bitField0_ = (bitField0_ & ~0x00000001);
symbol_ = 0;
symbol_ = 0L;
return this;
}
@@ -8,13 +8,13 @@ public interface IrConstructorCallOrBuilder extends
org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder {
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
boolean hasSymbol();
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
int getSymbol();
long getSymbol();
/**
* <code>required int32 constructor_type_arguments_count = 2;</code>
@@ -15,13 +15,4 @@ public interface IrConstructorOrBuilder extends
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrFunctionBase base = 1;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.IrFunctionBase getBase();
/**
* <code>required bool is_primary = 2;</code>
*/
boolean hasIsPrimary();
/**
* <code>required bool is_primary = 2;</code>
*/
boolean getIsPrimary();
}
@@ -55,39 +55,28 @@ public final class IrDeclarationBase extends
}
case 8: {
bitField0_ |= 0x00000001;
symbol_ = input.readInt32();
symbol_ = input.readInt64();
break;
}
case 18: {
org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin.Builder subBuilder = null;
if (((bitField0_ & 0x00000002) == 0x00000002)) {
subBuilder = origin_.toBuilder();
}
origin_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(origin_);
origin_ = subBuilder.buildPartial();
}
case 16: {
bitField0_ |= 0x00000002;
originName_ = input.readInt32();
break;
}
case 26: {
org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates.Builder subBuilder = null;
if (((bitField0_ & 0x00000004) == 0x00000004)) {
subBuilder = coordinates_.toBuilder();
}
coordinates_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(coordinates_);
coordinates_ = subBuilder.buildPartial();
}
case 24: {
bitField0_ |= 0x00000004;
coordinates_ = input.readInt64();
break;
}
case 34: {
if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
case 32: {
bitField0_ |= 0x00000008;
flags_ = input.readInt64();
break;
}
case 42: {
if (!((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
annotation_ = new java.util.ArrayList<org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall>();
mutable_bitField0_ |= 0x00000008;
mutable_bitField0_ |= 0x00000010;
}
annotation_.add(input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall.PARSER, extensionRegistry));
break;
@@ -100,7 +89,7 @@ public final class IrDeclarationBase extends
throw new org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
annotation_ = java.util.Collections.unmodifiableList(annotation_);
}
try {
@@ -130,79 +119,94 @@ public final class IrDeclarationBase extends
private int bitField0_;
public static final int SYMBOL_FIELD_NUMBER = 1;
private int symbol_;
private long symbol_;
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public boolean hasSymbol() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public int getSymbol() {
public long getSymbol() {
return symbol_;
}
public static final int ORIGIN_FIELD_NUMBER = 2;
private org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin origin_;
public static final int ORIGIN_NAME_FIELD_NUMBER = 2;
private int originName_;
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin origin = 2;</code>
* <code>required int32 origin_name = 2;</code>
*/
public boolean hasOrigin() {
public boolean hasOriginName() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin origin = 2;</code>
* <code>required int32 origin_name = 2;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin getOrigin() {
return origin_;
public int getOriginName() {
return originName_;
}
public static final int COORDINATES_FIELD_NUMBER = 3;
private org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates coordinates_;
private long coordinates_;
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates coordinates = 3;</code>
* <code>required int64 coordinates = 3;</code>
*/
public boolean hasCoordinates() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates coordinates = 3;</code>
* <code>required int64 coordinates = 3;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates getCoordinates() {
public long getCoordinates() {
return coordinates_;
}
public static final int ANNOTATION_FIELD_NUMBER = 4;
public static final int FLAGS_FIELD_NUMBER = 4;
private long flags_;
/**
* <code>optional int64 flags = 4 [default = 0];</code>
*/
public boolean hasFlags() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>optional int64 flags = 4 [default = 0];</code>
*/
public long getFlags() {
return flags_;
}
public static final int ANNOTATION_FIELD_NUMBER = 5;
private java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall> annotation_;
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 4;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 5;</code>
*/
public java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall> getAnnotationList() {
return annotation_;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 4;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 5;</code>
*/
public java.util.List<? extends org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCallOrBuilder>
getAnnotationOrBuilderList() {
return annotation_;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 4;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 5;</code>
*/
public int getAnnotationCount() {
return annotation_.size();
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 4;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 5;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall getAnnotation(int index) {
return annotation_.get(index);
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 4;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 5;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCallOrBuilder getAnnotationOrBuilder(
int index) {
@@ -210,9 +214,10 @@ public final class IrDeclarationBase extends
}
private void initFields() {
symbol_ = 0;
origin_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin.getDefaultInstance();
coordinates_ = org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates.getDefaultInstance();
symbol_ = 0L;
originName_ = 0;
coordinates_ = 0L;
flags_ = 0L;
annotation_ = java.util.Collections.emptyList();
}
private byte memoizedIsInitialized = -1;
@@ -225,7 +230,7 @@ public final class IrDeclarationBase extends
memoizedIsInitialized = 0;
return false;
}
if (!hasOrigin()) {
if (!hasOriginName()) {
memoizedIsInitialized = 0;
return false;
}
@@ -233,10 +238,6 @@ public final class IrDeclarationBase extends
memoizedIsInitialized = 0;
return false;
}
if (!getCoordinates().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
for (int i = 0; i < getAnnotationCount(); i++) {
if (!getAnnotation(i).isInitialized()) {
memoizedIsInitialized = 0;
@@ -251,16 +252,19 @@ public final class IrDeclarationBase extends
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeInt32(1, symbol_);
output.writeInt64(1, symbol_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeMessage(2, origin_);
output.writeInt32(2, originName_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeMessage(3, coordinates_);
output.writeInt64(3, coordinates_);
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
output.writeInt64(4, flags_);
}
for (int i = 0; i < annotation_.size(); i++) {
output.writeMessage(4, annotation_.get(i));
output.writeMessage(5, annotation_.get(i));
}
output.writeRawBytes(unknownFields);
}
@@ -273,19 +277,23 @@ public final class IrDeclarationBase extends
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(1, symbol_);
.computeInt64Size(1, symbol_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(2, origin_);
.computeInt32Size(2, originName_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(3, coordinates_);
.computeInt64Size(3, coordinates_);
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt64Size(4, flags_);
}
for (int i = 0; i < annotation_.size(); i++) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(4, annotation_.get(i));
.computeMessageSize(5, annotation_.get(i));
}
size += unknownFields.size();
memoizedSerializedSize = size;
@@ -381,14 +389,16 @@ public final class IrDeclarationBase extends
public Builder clear() {
super.clear();
symbol_ = 0;
symbol_ = 0L;
bitField0_ = (bitField0_ & ~0x00000001);
origin_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin.getDefaultInstance();
originName_ = 0;
bitField0_ = (bitField0_ & ~0x00000002);
coordinates_ = org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates.getDefaultInstance();
coordinates_ = 0L;
bitField0_ = (bitField0_ & ~0x00000004);
annotation_ = java.util.Collections.emptyList();
flags_ = 0L;
bitField0_ = (bitField0_ & ~0x00000008);
annotation_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000010);
return this;
}
@@ -419,14 +429,18 @@ public final class IrDeclarationBase extends
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.origin_ = origin_;
result.originName_ = originName_;
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
to_bitField0_ |= 0x00000004;
}
result.coordinates_ = coordinates_;
if (((bitField0_ & 0x00000008) == 0x00000008)) {
if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
to_bitField0_ |= 0x00000008;
}
result.flags_ = flags_;
if (((bitField0_ & 0x00000010) == 0x00000010)) {
annotation_ = java.util.Collections.unmodifiableList(annotation_);
bitField0_ = (bitField0_ & ~0x00000008);
bitField0_ = (bitField0_ & ~0x00000010);
}
result.annotation_ = annotation_;
result.bitField0_ = to_bitField0_;
@@ -438,16 +452,19 @@ public final class IrDeclarationBase extends
if (other.hasSymbol()) {
setSymbol(other.getSymbol());
}
if (other.hasOrigin()) {
mergeOrigin(other.getOrigin());
if (other.hasOriginName()) {
setOriginName(other.getOriginName());
}
if (other.hasCoordinates()) {
mergeCoordinates(other.getCoordinates());
setCoordinates(other.getCoordinates());
}
if (other.hasFlags()) {
setFlags(other.getFlags());
}
if (!other.annotation_.isEmpty()) {
if (annotation_.isEmpty()) {
annotation_ = other.annotation_;
bitField0_ = (bitField0_ & ~0x00000008);
bitField0_ = (bitField0_ & ~0x00000010);
} else {
ensureAnnotationIsMutable();
annotation_.addAll(other.annotation_);
@@ -464,7 +481,7 @@ public final class IrDeclarationBase extends
return false;
}
if (!hasOrigin()) {
if (!hasOriginName()) {
return false;
}
@@ -472,10 +489,6 @@ public final class IrDeclarationBase extends
return false;
}
if (!getCoordinates().isInitialized()) {
return false;
}
for (int i = 0; i < getAnnotationCount(); i++) {
if (!getAnnotation(i).isInitialized()) {
@@ -504,187 +517,163 @@ public final class IrDeclarationBase extends
}
private int bitField0_;
private int symbol_ ;
private long symbol_ ;
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public boolean hasSymbol() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public int getSymbol() {
public long getSymbol() {
return symbol_;
}
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public Builder setSymbol(int value) {
public Builder setSymbol(long value) {
bitField0_ |= 0x00000001;
symbol_ = value;
return this;
}
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public Builder clearSymbol() {
bitField0_ = (bitField0_ & ~0x00000001);
symbol_ = 0;
symbol_ = 0L;
return this;
}
private org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin origin_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin.getDefaultInstance();
private int originName_ ;
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin origin = 2;</code>
* <code>required int32 origin_name = 2;</code>
*/
public boolean hasOrigin() {
public boolean hasOriginName() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin origin = 2;</code>
* <code>required int32 origin_name = 2;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin getOrigin() {
return origin_;
public int getOriginName() {
return originName_;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin origin = 2;</code>
* <code>required int32 origin_name = 2;</code>
*/
public Builder setOrigin(org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin value) {
if (value == null) {
throw new NullPointerException();
}
origin_ = value;
public Builder setOriginName(int value) {
bitField0_ |= 0x00000002;
originName_ = value;
return this;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin origin = 2;</code>
* <code>required int32 origin_name = 2;</code>
*/
public Builder setOrigin(
org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin.Builder builderForValue) {
origin_ = builderForValue.build();
bitField0_ |= 0x00000002;
return this;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin origin = 2;</code>
*/
public Builder mergeOrigin(org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin value) {
if (((bitField0_ & 0x00000002) == 0x00000002) &&
origin_ != org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin.getDefaultInstance()) {
origin_ =
org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin.newBuilder(origin_).mergeFrom(value).buildPartial();
} else {
origin_ = value;
}
bitField0_ |= 0x00000002;
return this;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin origin = 2;</code>
*/
public Builder clearOrigin() {
origin_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin.getDefaultInstance();
public Builder clearOriginName() {
bitField0_ = (bitField0_ & ~0x00000002);
originName_ = 0;
return this;
}
private org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates coordinates_ = org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates.getDefaultInstance();
private long coordinates_ ;
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates coordinates = 3;</code>
* <code>required int64 coordinates = 3;</code>
*/
public boolean hasCoordinates() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates coordinates = 3;</code>
* <code>required int64 coordinates = 3;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates getCoordinates() {
public long getCoordinates() {
return coordinates_;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates coordinates = 3;</code>
* <code>required int64 coordinates = 3;</code>
*/
public Builder setCoordinates(org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates value) {
if (value == null) {
throw new NullPointerException();
}
public Builder setCoordinates(long value) {
bitField0_ |= 0x00000004;
coordinates_ = value;
bitField0_ |= 0x00000004;
return this;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates coordinates = 3;</code>
*/
public Builder setCoordinates(
org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates.Builder builderForValue) {
coordinates_ = builderForValue.build();
bitField0_ |= 0x00000004;
return this;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates coordinates = 3;</code>
*/
public Builder mergeCoordinates(org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates value) {
if (((bitField0_ & 0x00000004) == 0x00000004) &&
coordinates_ != org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates.getDefaultInstance()) {
coordinates_ =
org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates.newBuilder(coordinates_).mergeFrom(value).buildPartial();
} else {
coordinates_ = value;
}
bitField0_ |= 0x00000004;
return this;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates coordinates = 3;</code>
* <code>required int64 coordinates = 3;</code>
*/
public Builder clearCoordinates() {
coordinates_ = org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000004);
coordinates_ = 0L;
return this;
}
private long flags_ ;
/**
* <code>optional int64 flags = 4 [default = 0];</code>
*/
public boolean hasFlags() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>optional int64 flags = 4 [default = 0];</code>
*/
public long getFlags() {
return flags_;
}
/**
* <code>optional int64 flags = 4 [default = 0];</code>
*/
public Builder setFlags(long value) {
bitField0_ |= 0x00000008;
flags_ = value;
return this;
}
/**
* <code>optional int64 flags = 4 [default = 0];</code>
*/
public Builder clearFlags() {
bitField0_ = (bitField0_ & ~0x00000008);
flags_ = 0L;
return this;
}
private java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall> annotation_ =
java.util.Collections.emptyList();
private void ensureAnnotationIsMutable() {
if (!((bitField0_ & 0x00000008) == 0x00000008)) {
if (!((bitField0_ & 0x00000010) == 0x00000010)) {
annotation_ = new java.util.ArrayList<org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall>(annotation_);
bitField0_ |= 0x00000008;
bitField0_ |= 0x00000010;
}
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 4;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 5;</code>
*/
public java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall> getAnnotationList() {
return java.util.Collections.unmodifiableList(annotation_);
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 4;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 5;</code>
*/
public int getAnnotationCount() {
return annotation_.size();
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 4;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 5;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall getAnnotation(int index) {
return annotation_.get(index);
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 4;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 5;</code>
*/
public Builder setAnnotation(
int index, org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall value) {
@@ -697,7 +686,7 @@ public final class IrDeclarationBase extends
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 4;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 5;</code>
*/
public Builder setAnnotation(
int index, org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall.Builder builderForValue) {
@@ -707,7 +696,7 @@ public final class IrDeclarationBase extends
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 4;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 5;</code>
*/
public Builder addAnnotation(org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall value) {
if (value == null) {
@@ -719,7 +708,7 @@ public final class IrDeclarationBase extends
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 4;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 5;</code>
*/
public Builder addAnnotation(
int index, org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall value) {
@@ -732,7 +721,7 @@ public final class IrDeclarationBase extends
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 4;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 5;</code>
*/
public Builder addAnnotation(
org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall.Builder builderForValue) {
@@ -742,7 +731,7 @@ public final class IrDeclarationBase extends
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 4;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 5;</code>
*/
public Builder addAnnotation(
int index, org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall.Builder builderForValue) {
@@ -752,7 +741,7 @@ public final class IrDeclarationBase extends
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 4;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 5;</code>
*/
public Builder addAllAnnotation(
java.lang.Iterable<? extends org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall> values) {
@@ -763,16 +752,16 @@ public final class IrDeclarationBase extends
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 4;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 5;</code>
*/
public Builder clearAnnotation() {
annotation_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000008);
bitField0_ = (bitField0_ & ~0x00000010);
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 4;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 5;</code>
*/
public Builder removeAnnotation(int index) {
ensureAnnotationIsMutable();
@@ -8,43 +8,52 @@ public interface IrDeclarationBaseOrBuilder extends
org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder {
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
boolean hasSymbol();
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
int getSymbol();
long getSymbol();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin origin = 2;</code>
* <code>required int32 origin_name = 2;</code>
*/
boolean hasOrigin();
boolean hasOriginName();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin origin = 2;</code>
* <code>required int32 origin_name = 2;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin getOrigin();
int getOriginName();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates coordinates = 3;</code>
* <code>required int64 coordinates = 3;</code>
*/
boolean hasCoordinates();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates coordinates = 3;</code>
* <code>required int64 coordinates = 3;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates getCoordinates();
long getCoordinates();
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 4;</code>
* <code>optional int64 flags = 4 [default = 0];</code>
*/
boolean hasFlags();
/**
* <code>optional int64 flags = 4 [default = 0];</code>
*/
long getFlags();
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 5;</code>
*/
java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall>
getAnnotationList();
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 4;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 5;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall getAnnotation(int index);
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 4;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall annotation = 5;</code>
*/
int getAnnotationCount();
}
@@ -1,479 +0,0 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: compiler/ir/serialization.common/src/KotlinIr.proto
package org.jetbrains.kotlin.backend.common.serialization.proto;
/**
* Protobuf type {@code org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer}
*/
public final class IrDeclarationContainer extends
org.jetbrains.kotlin.protobuf.GeneratedMessageLite implements
// @@protoc_insertion_point(message_implements:org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer)
IrDeclarationContainerOrBuilder {
// Use IrDeclarationContainer.newBuilder() to construct.
private IrDeclarationContainer(org.jetbrains.kotlin.protobuf.GeneratedMessageLite.Builder builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private IrDeclarationContainer(boolean noInit) { this.unknownFields = org.jetbrains.kotlin.protobuf.ByteString.EMPTY;}
private static final IrDeclarationContainer defaultInstance;
public static IrDeclarationContainer getDefaultInstance() {
return defaultInstance;
}
public IrDeclarationContainer getDefaultInstanceForType() {
return defaultInstance;
}
private final org.jetbrains.kotlin.protobuf.ByteString unknownFields;
private IrDeclarationContainer(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
org.jetbrains.kotlin.protobuf.ByteString.Output unknownFieldsOutput =
org.jetbrains.kotlin.protobuf.ByteString.newOutput();
org.jetbrains.kotlin.protobuf.CodedOutputStream unknownFieldsCodedOutput =
org.jetbrains.kotlin.protobuf.CodedOutputStream.newInstance(
unknownFieldsOutput, 1);
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFieldsCodedOutput,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
declaration_ = new java.util.ArrayList<org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration>();
mutable_bitField0_ |= 0x00000001;
}
declaration_.add(input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration.PARSER, extensionRegistry));
break;
}
}
}
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
declaration_ = java.util.Collections.unmodifiableList(declaration_);
}
try {
unknownFieldsCodedOutput.flush();
} catch (java.io.IOException e) {
// Should not happen
} finally {
unknownFields = unknownFieldsOutput.toByteString();
}
makeExtensionsImmutable();
}
}
public static org.jetbrains.kotlin.protobuf.Parser<IrDeclarationContainer> PARSER =
new org.jetbrains.kotlin.protobuf.AbstractParser<IrDeclarationContainer>() {
public IrDeclarationContainer parsePartialFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return new IrDeclarationContainer(input, extensionRegistry);
}
};
@java.lang.Override
public org.jetbrains.kotlin.protobuf.Parser<IrDeclarationContainer> getParserForType() {
return PARSER;
}
public static final int DECLARATION_FIELD_NUMBER = 1;
private java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration> declaration_;
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration declaration = 1;</code>
*/
public java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration> getDeclarationList() {
return declaration_;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration declaration = 1;</code>
*/
public java.util.List<? extends org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrBuilder>
getDeclarationOrBuilderList() {
return declaration_;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration declaration = 1;</code>
*/
public int getDeclarationCount() {
return declaration_.size();
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration declaration = 1;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration getDeclaration(int index) {
return declaration_.get(index);
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration declaration = 1;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrBuilder getDeclarationOrBuilder(
int index) {
return declaration_.get(index);
}
private void initFields() {
declaration_ = java.util.Collections.emptyList();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
for (int i = 0; i < getDeclarationCount(); i++) {
if (!getDeclaration(i).isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(org.jetbrains.kotlin.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
for (int i = 0; i < declaration_.size(); i++) {
output.writeMessage(1, declaration_.get(i));
}
output.writeRawBytes(unknownFields);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
for (int i = 0; i < declaration_.size(); i++) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(1, declaration_.get(i));
}
size += unknownFields.size();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer parseFrom(
org.jetbrains.kotlin.protobuf.ByteString data)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer parseFrom(
org.jetbrains.kotlin.protobuf.ByteString data,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer parseFrom(byte[] data)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer parseFrom(
byte[] data,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer parseFrom(
java.io.InputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer parseDelimitedFrom(
java.io.InputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer parseFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer parseFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
/**
* Protobuf type {@code org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer}
*/
public static final class Builder extends
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.Builder<
org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer, Builder>
implements
// @@protoc_insertion_point(builder_implements:org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer)
org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainerOrBuilder {
// Construct using org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
declaration_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer getDefaultInstanceForType() {
return org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer.getDefaultInstance();
}
public org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer build() {
org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer buildPartial() {
org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer result = new org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer(this);
int from_bitField0_ = bitField0_;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
declaration_ = java.util.Collections.unmodifiableList(declaration_);
bitField0_ = (bitField0_ & ~0x00000001);
}
result.declaration_ = declaration_;
return result;
}
public Builder mergeFrom(org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer other) {
if (other == org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer.getDefaultInstance()) return this;
if (!other.declaration_.isEmpty()) {
if (declaration_.isEmpty()) {
declaration_ = other.declaration_;
bitField0_ = (bitField0_ & ~0x00000001);
} else {
ensureDeclarationIsMutable();
declaration_.addAll(other.declaration_);
}
}
setUnknownFields(
getUnknownFields().concat(other.unknownFields));
return this;
}
public final boolean isInitialized() {
for (int i = 0; i < getDeclarationCount(); i++) {
if (!getDeclaration(i).isInitialized()) {
return false;
}
}
return true;
}
public Builder mergeFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration> declaration_ =
java.util.Collections.emptyList();
private void ensureDeclarationIsMutable() {
if (!((bitField0_ & 0x00000001) == 0x00000001)) {
declaration_ = new java.util.ArrayList<org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration>(declaration_);
bitField0_ |= 0x00000001;
}
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration declaration = 1;</code>
*/
public java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration> getDeclarationList() {
return java.util.Collections.unmodifiableList(declaration_);
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration declaration = 1;</code>
*/
public int getDeclarationCount() {
return declaration_.size();
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration declaration = 1;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration getDeclaration(int index) {
return declaration_.get(index);
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration declaration = 1;</code>
*/
public Builder setDeclaration(
int index, org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration value) {
if (value == null) {
throw new NullPointerException();
}
ensureDeclarationIsMutable();
declaration_.set(index, value);
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration declaration = 1;</code>
*/
public Builder setDeclaration(
int index, org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration.Builder builderForValue) {
ensureDeclarationIsMutable();
declaration_.set(index, builderForValue.build());
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration declaration = 1;</code>
*/
public Builder addDeclaration(org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration value) {
if (value == null) {
throw new NullPointerException();
}
ensureDeclarationIsMutable();
declaration_.add(value);
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration declaration = 1;</code>
*/
public Builder addDeclaration(
int index, org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration value) {
if (value == null) {
throw new NullPointerException();
}
ensureDeclarationIsMutable();
declaration_.add(index, value);
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration declaration = 1;</code>
*/
public Builder addDeclaration(
org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration.Builder builderForValue) {
ensureDeclarationIsMutable();
declaration_.add(builderForValue.build());
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration declaration = 1;</code>
*/
public Builder addDeclaration(
int index, org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration.Builder builderForValue) {
ensureDeclarationIsMutable();
declaration_.add(index, builderForValue.build());
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration declaration = 1;</code>
*/
public Builder addAllDeclaration(
java.lang.Iterable<? extends org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration> values) {
ensureDeclarationIsMutable();
org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll(
values, declaration_);
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration declaration = 1;</code>
*/
public Builder clearDeclaration() {
declaration_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration declaration = 1;</code>
*/
public Builder removeDeclaration(int index) {
ensureDeclarationIsMutable();
declaration_.remove(index);
return this;
}
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer)
}
static {
defaultInstance = new IrDeclarationContainer(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer)
}
@@ -1,23 +0,0 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: compiler/ir/serialization.common/src/KotlinIr.proto
package org.jetbrains.kotlin.backend.common.serialization.proto;
public interface IrDeclarationContainerOrBuilder extends
// @@protoc_insertion_point(interface_extends:org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer)
org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder {
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration declaration = 1;</code>
*/
java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration>
getDeclarationList();
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration declaration = 1;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration getDeclaration(int index);
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration declaration = 1;</code>
*/
int getDeclarationCount();
}
@@ -1,483 +0,0 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: compiler/ir/serialization.common/src/KotlinIr.proto
package org.jetbrains.kotlin.backend.common.serialization.proto;
/**
* Protobuf type {@code org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin}
*/
public final class IrDeclarationOrigin extends
org.jetbrains.kotlin.protobuf.GeneratedMessageLite implements
// @@protoc_insertion_point(message_implements:org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin)
IrDeclarationOriginOrBuilder {
// Use IrDeclarationOrigin.newBuilder() to construct.
private IrDeclarationOrigin(org.jetbrains.kotlin.protobuf.GeneratedMessageLite.Builder builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private IrDeclarationOrigin(boolean noInit) { this.unknownFields = org.jetbrains.kotlin.protobuf.ByteString.EMPTY;}
private static final IrDeclarationOrigin defaultInstance;
public static IrDeclarationOrigin getDefaultInstance() {
return defaultInstance;
}
public IrDeclarationOrigin getDefaultInstanceForType() {
return defaultInstance;
}
private final org.jetbrains.kotlin.protobuf.ByteString unknownFields;
private IrDeclarationOrigin(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
org.jetbrains.kotlin.protobuf.ByteString.Output unknownFieldsOutput =
org.jetbrains.kotlin.protobuf.ByteString.newOutput();
org.jetbrains.kotlin.protobuf.CodedOutputStream unknownFieldsCodedOutput =
org.jetbrains.kotlin.protobuf.CodedOutputStream.newInstance(
unknownFieldsOutput, 1);
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFieldsCodedOutput,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 8: {
int rawValue = input.readEnum();
org.jetbrains.kotlin.backend.common.serialization.proto.KnownOrigin value = org.jetbrains.kotlin.backend.common.serialization.proto.KnownOrigin.valueOf(rawValue);
if (value == null) {
unknownFieldsCodedOutput.writeRawVarint32(tag);
unknownFieldsCodedOutput.writeRawVarint32(rawValue);
} else {
eitherCase_ = 1;
either_ = value;
}
break;
}
case 16: {
eitherCase_ = 2;
either_ = input.readInt32();
break;
}
}
}
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
try {
unknownFieldsCodedOutput.flush();
} catch (java.io.IOException e) {
// Should not happen
} finally {
unknownFields = unknownFieldsOutput.toByteString();
}
makeExtensionsImmutable();
}
}
public static org.jetbrains.kotlin.protobuf.Parser<IrDeclarationOrigin> PARSER =
new org.jetbrains.kotlin.protobuf.AbstractParser<IrDeclarationOrigin>() {
public IrDeclarationOrigin parsePartialFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return new IrDeclarationOrigin(input, extensionRegistry);
}
};
@java.lang.Override
public org.jetbrains.kotlin.protobuf.Parser<IrDeclarationOrigin> getParserForType() {
return PARSER;
}
private int bitField0_;
private int eitherCase_ = 0;
private java.lang.Object either_;
public enum EitherCase
implements org.jetbrains.kotlin.protobuf.Internal.EnumLite {
ORIGIN(1),
CUSTOM(2),
EITHER_NOT_SET(0);
private int value = 0;
private EitherCase(int value) {
this.value = value;
}
public static EitherCase valueOf(int value) {
switch (value) {
case 1: return ORIGIN;
case 2: return CUSTOM;
case 0: return EITHER_NOT_SET;
default: throw new java.lang.IllegalArgumentException(
"Value is undefined for this oneof enum.");
}
}
public int getNumber() {
return this.value;
}
};
public EitherCase
getEitherCase() {
return EitherCase.valueOf(
eitherCase_);
}
public static final int ORIGIN_FIELD_NUMBER = 1;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.KnownOrigin origin = 1;</code>
*/
public boolean hasOrigin() {
return eitherCase_ == 1;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.KnownOrigin origin = 1;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.KnownOrigin getOrigin() {
if (eitherCase_ == 1) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.KnownOrigin) either_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.KnownOrigin.CUSTOM;
}
public static final int CUSTOM_FIELD_NUMBER = 2;
/**
* <code>optional int32 custom = 2;</code>
*/
public boolean hasCustom() {
return eitherCase_ == 2;
}
/**
* <code>optional int32 custom = 2;</code>
*/
public int getCustom() {
if (eitherCase_ == 2) {
return (java.lang.Integer) either_;
}
return 0;
}
private void initFields() {
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
public void writeTo(org.jetbrains.kotlin.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (eitherCase_ == 1) {
output.writeEnum(1, ((org.jetbrains.kotlin.backend.common.serialization.proto.KnownOrigin) either_).getNumber());
}
if (eitherCase_ == 2) {
output.writeInt32(
2, (int)((java.lang.Integer) either_));
}
output.writeRawBytes(unknownFields);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (eitherCase_ == 1) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeEnumSize(1, ((org.jetbrains.kotlin.backend.common.serialization.proto.KnownOrigin) either_).getNumber());
}
if (eitherCase_ == 2) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(
2, (int)((java.lang.Integer) either_));
}
size += unknownFields.size();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin parseFrom(
org.jetbrains.kotlin.protobuf.ByteString data)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin parseFrom(
org.jetbrains.kotlin.protobuf.ByteString data,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin parseFrom(byte[] data)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin parseFrom(
byte[] data,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin parseFrom(
java.io.InputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin parseDelimitedFrom(
java.io.InputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin parseFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin parseFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
/**
* Protobuf type {@code org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin}
*/
public static final class Builder extends
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.Builder<
org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin, Builder>
implements
// @@protoc_insertion_point(builder_implements:org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin)
org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOriginOrBuilder {
// Construct using org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
eitherCase_ = 0;
either_ = null;
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin getDefaultInstanceForType() {
return org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin.getDefaultInstance();
}
public org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin build() {
org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin buildPartial() {
org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin result = new org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (eitherCase_ == 1) {
result.either_ = either_;
}
if (eitherCase_ == 2) {
result.either_ = either_;
}
result.bitField0_ = to_bitField0_;
result.eitherCase_ = eitherCase_;
return result;
}
public Builder mergeFrom(org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin other) {
if (other == org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin.getDefaultInstance()) return this;
switch (other.getEitherCase()) {
case ORIGIN: {
setOrigin(other.getOrigin());
break;
}
case CUSTOM: {
setCustom(other.getCustom());
break;
}
case EITHER_NOT_SET: {
break;
}
}
setUnknownFields(
getUnknownFields().concat(other.unknownFields));
return this;
}
public final boolean isInitialized() {
return true;
}
public Builder mergeFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int eitherCase_ = 0;
private java.lang.Object either_;
public EitherCase
getEitherCase() {
return EitherCase.valueOf(
eitherCase_);
}
public Builder clearEither() {
eitherCase_ = 0;
either_ = null;
return this;
}
private int bitField0_;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.KnownOrigin origin = 1;</code>
*/
public boolean hasOrigin() {
return eitherCase_ == 1;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.KnownOrigin origin = 1;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.KnownOrigin getOrigin() {
if (eitherCase_ == 1) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.KnownOrigin) either_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.KnownOrigin.CUSTOM;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.KnownOrigin origin = 1;</code>
*/
public Builder setOrigin(org.jetbrains.kotlin.backend.common.serialization.proto.KnownOrigin value) {
if (value == null) {
throw new NullPointerException();
}
eitherCase_ = 1;
either_ = value;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.KnownOrigin origin = 1;</code>
*/
public Builder clearOrigin() {
if (eitherCase_ == 1) {
eitherCase_ = 0;
either_ = null;
}
return this;
}
/**
* <code>optional int32 custom = 2;</code>
*/
public boolean hasCustom() {
return eitherCase_ == 2;
}
/**
* <code>optional int32 custom = 2;</code>
*/
public int getCustom() {
if (eitherCase_ == 2) {
return (java.lang.Integer) either_;
}
return 0;
}
/**
* <code>optional int32 custom = 2;</code>
*/
public Builder setCustom(int value) {
eitherCase_ = 2;
either_ = value;
return this;
}
/**
* <code>optional int32 custom = 2;</code>
*/
public Builder clearCustom() {
if (eitherCase_ == 2) {
eitherCase_ = 0;
either_ = null;
}
return this;
}
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin)
}
static {
defaultInstance = new IrDeclarationOrigin(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin)
}
@@ -1,27 +0,0 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: compiler/ir/serialization.common/src/KotlinIr.proto
package org.jetbrains.kotlin.backend.common.serialization.proto;
public interface IrDeclarationOriginOrBuilder extends
// @@protoc_insertion_point(interface_extends:org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrigin)
org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder {
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.KnownOrigin origin = 1;</code>
*/
boolean hasOrigin();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.KnownOrigin origin = 1;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.KnownOrigin getOrigin();
/**
* <code>optional int32 custom = 2;</code>
*/
boolean hasCustom();
/**
* <code>optional int32 custom = 2;</code>
*/
int getCustom();
}
@@ -55,7 +55,7 @@ public final class IrDelegatingConstructorCall extends
}
case 8: {
bitField0_ |= 0x00000001;
symbol_ = input.readInt32();
symbol_ = input.readInt64();
break;
}
case 18: {
@@ -106,17 +106,17 @@ public final class IrDelegatingConstructorCall extends
private int bitField0_;
public static final int SYMBOL_FIELD_NUMBER = 1;
private int symbol_;
private long symbol_;
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public boolean hasSymbol() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public int getSymbol() {
public long getSymbol() {
return symbol_;
}
@@ -136,7 +136,7 @@ public final class IrDelegatingConstructorCall extends
}
private void initFields() {
symbol_ = 0;
symbol_ = 0L;
memberAccess_ = org.jetbrains.kotlin.backend.common.serialization.proto.MemberAccessCommon.getDefaultInstance();
}
private byte memoizedIsInitialized = -1;
@@ -165,7 +165,7 @@ public final class IrDelegatingConstructorCall extends
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeInt32(1, symbol_);
output.writeInt64(1, symbol_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeMessage(2, memberAccess_);
@@ -181,7 +181,7 @@ public final class IrDelegatingConstructorCall extends
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(1, symbol_);
.computeInt64Size(1, symbol_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
@@ -281,7 +281,7 @@ public final class IrDelegatingConstructorCall extends
public Builder clear() {
super.clear();
symbol_ = 0;
symbol_ = 0L;
bitField0_ = (bitField0_ & ~0x00000001);
memberAccess_ = org.jetbrains.kotlin.backend.common.serialization.proto.MemberAccessCommon.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000002);
@@ -368,34 +368,34 @@ public final class IrDelegatingConstructorCall extends
}
private int bitField0_;
private int symbol_ ;
private long symbol_ ;
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public boolean hasSymbol() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public int getSymbol() {
public long getSymbol() {
return symbol_;
}
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public Builder setSymbol(int value) {
public Builder setSymbol(long value) {
bitField0_ |= 0x00000001;
symbol_ = value;
return this;
}
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public Builder clearSymbol() {
bitField0_ = (bitField0_ & ~0x00000001);
symbol_ = 0;
symbol_ = 0L;
return this;
}
@@ -8,13 +8,13 @@ public interface IrDelegatingConstructorCallOrBuilder extends
org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder {
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
boolean hasSymbol();
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
int getSymbol();
long getSymbol();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.MemberAccessCommon member_access = 2;</code>
@@ -55,7 +55,7 @@ public final class IrEnumConstructorCall extends
}
case 8: {
bitField0_ |= 0x00000001;
symbol_ = input.readInt32();
symbol_ = input.readInt64();
break;
}
case 18: {
@@ -106,17 +106,17 @@ public final class IrEnumConstructorCall extends
private int bitField0_;
public static final int SYMBOL_FIELD_NUMBER = 1;
private int symbol_;
private long symbol_;
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public boolean hasSymbol() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public int getSymbol() {
public long getSymbol() {
return symbol_;
}
@@ -136,7 +136,7 @@ public final class IrEnumConstructorCall extends
}
private void initFields() {
symbol_ = 0;
symbol_ = 0L;
memberAccess_ = org.jetbrains.kotlin.backend.common.serialization.proto.MemberAccessCommon.getDefaultInstance();
}
private byte memoizedIsInitialized = -1;
@@ -165,7 +165,7 @@ public final class IrEnumConstructorCall extends
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeInt32(1, symbol_);
output.writeInt64(1, symbol_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeMessage(2, memberAccess_);
@@ -181,7 +181,7 @@ public final class IrEnumConstructorCall extends
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(1, symbol_);
.computeInt64Size(1, symbol_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
@@ -281,7 +281,7 @@ public final class IrEnumConstructorCall extends
public Builder clear() {
super.clear();
symbol_ = 0;
symbol_ = 0L;
bitField0_ = (bitField0_ & ~0x00000001);
memberAccess_ = org.jetbrains.kotlin.backend.common.serialization.proto.MemberAccessCommon.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000002);
@@ -368,34 +368,34 @@ public final class IrEnumConstructorCall extends
}
private int bitField0_;
private int symbol_ ;
private long symbol_ ;
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public boolean hasSymbol() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public int getSymbol() {
public long getSymbol() {
return symbol_;
}
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public Builder setSymbol(int value) {
public Builder setSymbol(long value) {
bitField0_ |= 0x00000001;
symbol_ = value;
return this;
}
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
public Builder clearSymbol() {
bitField0_ = (bitField0_ & ~0x00000001);
symbol_ = 0;
symbol_ = 0L;
return this;
}
@@ -8,13 +8,13 @@ public interface IrEnumConstructorCallOrBuilder extends
org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder {
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
boolean hasSymbol();
/**
* <code>required int32 symbol = 1;</code>
* <code>required int64 symbol = 1;</code>
*/
int getSymbol();
long getSymbol();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.MemberAccessCommon member_access = 2;</code>
@@ -68,12 +68,17 @@ public final class IrEnumEntry extends
}
case 16: {
bitField0_ |= 0x00000002;
name_ = input.readInt32();
break;
}
case 24: {
bitField0_ |= 0x00000004;
initializer_ = input.readInt32();
break;
}
case 26: {
case 34: {
org.jetbrains.kotlin.backend.common.serialization.proto.IrClass.Builder subBuilder = null;
if (((bitField0_ & 0x00000004) == 0x00000004)) {
if (((bitField0_ & 0x00000008) == 0x00000008)) {
subBuilder = correspondingClass_.toBuilder();
}
correspondingClass_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.IrClass.PARSER, extensionRegistry);
@@ -81,12 +86,7 @@ public final class IrEnumEntry extends
subBuilder.mergeFrom(correspondingClass_);
correspondingClass_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000004;
break;
}
case 32: {
bitField0_ |= 0x00000008;
name_ = input.readInt32();
break;
}
}
@@ -138,56 +138,56 @@ public final class IrEnumEntry extends
return base_;
}
public static final int INITIALIZER_FIELD_NUMBER = 2;
private int initializer_;
public static final int NAME_FIELD_NUMBER = 2;
private int name_;
/**
* <code>optional int32 initializer = 2;</code>
* <code>required int32 name = 2;</code>
*/
public boolean hasInitializer() {
public boolean hasName() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>optional int32 initializer = 2;</code>
*/
public int getInitializer() {
return initializer_;
}
public static final int CORRESPONDING_CLASS_FIELD_NUMBER = 3;
private org.jetbrains.kotlin.backend.common.serialization.proto.IrClass correspondingClass_;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrClass corresponding_class = 3;</code>
*/
public boolean hasCorrespondingClass() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrClass corresponding_class = 3;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrClass getCorrespondingClass() {
return correspondingClass_;
}
public static final int NAME_FIELD_NUMBER = 4;
private int name_;
/**
* <code>required int32 name = 4;</code>
*/
public boolean hasName() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>required int32 name = 4;</code>
* <code>required int32 name = 2;</code>
*/
public int getName() {
return name_;
}
public static final int INITIALIZER_FIELD_NUMBER = 3;
private int initializer_;
/**
* <code>optional int32 initializer = 3;</code>
*/
public boolean hasInitializer() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>optional int32 initializer = 3;</code>
*/
public int getInitializer() {
return initializer_;
}
public static final int CORRESPONDING_CLASS_FIELD_NUMBER = 4;
private org.jetbrains.kotlin.backend.common.serialization.proto.IrClass correspondingClass_;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrClass corresponding_class = 4;</code>
*/
public boolean hasCorrespondingClass() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrClass corresponding_class = 4;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrClass getCorrespondingClass() {
return correspondingClass_;
}
private void initFields() {
base_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationBase.getDefaultInstance();
name_ = 0;
initializer_ = 0;
correspondingClass_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrClass.getDefaultInstance();
name_ = 0;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
@@ -224,13 +224,13 @@ public final class IrEnumEntry extends
output.writeMessage(1, base_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeInt32(2, initializer_);
output.writeInt32(2, name_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeMessage(3, correspondingClass_);
output.writeInt32(3, initializer_);
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
output.writeInt32(4, name_);
output.writeMessage(4, correspondingClass_);
}
output.writeRawBytes(unknownFields);
}
@@ -247,15 +247,15 @@ public final class IrEnumEntry extends
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(2, initializer_);
.computeInt32Size(2, name_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(3, correspondingClass_);
.computeInt32Size(3, initializer_);
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(4, name_);
.computeMessageSize(4, correspondingClass_);
}
size += unknownFields.size();
memoizedSerializedSize = size;
@@ -353,11 +353,11 @@ public final class IrEnumEntry extends
super.clear();
base_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationBase.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000001);
initializer_ = 0;
bitField0_ = (bitField0_ & ~0x00000002);
correspondingClass_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrClass.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000004);
name_ = 0;
bitField0_ = (bitField0_ & ~0x00000002);
initializer_ = 0;
bitField0_ = (bitField0_ & ~0x00000004);
correspondingClass_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrClass.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000008);
return this;
}
@@ -389,15 +389,15 @@ public final class IrEnumEntry extends
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.initializer_ = initializer_;
result.name_ = name_;
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
to_bitField0_ |= 0x00000004;
}
result.correspondingClass_ = correspondingClass_;
result.initializer_ = initializer_;
if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
to_bitField0_ |= 0x00000008;
}
result.name_ = name_;
result.correspondingClass_ = correspondingClass_;
result.bitField0_ = to_bitField0_;
return result;
}
@@ -407,15 +407,15 @@ public final class IrEnumEntry extends
if (other.hasBase()) {
mergeBase(other.getBase());
}
if (other.hasName()) {
setName(other.getName());
}
if (other.hasInitializer()) {
setInitializer(other.getInitializer());
}
if (other.hasCorrespondingClass()) {
mergeCorrespondingClass(other.getCorrespondingClass());
}
if (other.hasName()) {
setName(other.getName());
}
setUnknownFields(
getUnknownFields().concat(other.unknownFields));
return this;
@@ -522,33 +522,65 @@ public final class IrEnumEntry extends
return this;
}
private int initializer_ ;
private int name_ ;
/**
* <code>optional int32 initializer = 2;</code>
* <code>required int32 name = 2;</code>
*/
public boolean hasInitializer() {
public boolean hasName() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>optional int32 initializer = 2;</code>
* <code>required int32 name = 2;</code>
*/
public int getName() {
return name_;
}
/**
* <code>required int32 name = 2;</code>
*/
public Builder setName(int value) {
bitField0_ |= 0x00000002;
name_ = value;
return this;
}
/**
* <code>required int32 name = 2;</code>
*/
public Builder clearName() {
bitField0_ = (bitField0_ & ~0x00000002);
name_ = 0;
return this;
}
private int initializer_ ;
/**
* <code>optional int32 initializer = 3;</code>
*/
public boolean hasInitializer() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>optional int32 initializer = 3;</code>
*/
public int getInitializer() {
return initializer_;
}
/**
* <code>optional int32 initializer = 2;</code>
* <code>optional int32 initializer = 3;</code>
*/
public Builder setInitializer(int value) {
bitField0_ |= 0x00000002;
bitField0_ |= 0x00000004;
initializer_ = value;
return this;
}
/**
* <code>optional int32 initializer = 2;</code>
* <code>optional int32 initializer = 3;</code>
*/
public Builder clearInitializer() {
bitField0_ = (bitField0_ & ~0x00000002);
bitField0_ = (bitField0_ & ~0x00000004);
initializer_ = 0;
return this;
@@ -556,19 +588,19 @@ public final class IrEnumEntry extends
private org.jetbrains.kotlin.backend.common.serialization.proto.IrClass correspondingClass_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrClass.getDefaultInstance();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrClass corresponding_class = 3;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrClass corresponding_class = 4;</code>
*/
public boolean hasCorrespondingClass() {
return ((bitField0_ & 0x00000004) == 0x00000004);
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrClass corresponding_class = 3;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrClass corresponding_class = 4;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrClass getCorrespondingClass() {
return correspondingClass_;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrClass corresponding_class = 3;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrClass corresponding_class = 4;</code>
*/
public Builder setCorrespondingClass(org.jetbrains.kotlin.backend.common.serialization.proto.IrClass value) {
if (value == null) {
@@ -576,24 +608,24 @@ public final class IrEnumEntry extends
}
correspondingClass_ = value;
bitField0_ |= 0x00000004;
bitField0_ |= 0x00000008;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrClass corresponding_class = 3;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrClass corresponding_class = 4;</code>
*/
public Builder setCorrespondingClass(
org.jetbrains.kotlin.backend.common.serialization.proto.IrClass.Builder builderForValue) {
correspondingClass_ = builderForValue.build();
bitField0_ |= 0x00000004;
bitField0_ |= 0x00000008;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrClass corresponding_class = 3;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrClass corresponding_class = 4;</code>
*/
public Builder mergeCorrespondingClass(org.jetbrains.kotlin.backend.common.serialization.proto.IrClass value) {
if (((bitField0_ & 0x00000004) == 0x00000004) &&
if (((bitField0_ & 0x00000008) == 0x00000008) &&
correspondingClass_ != org.jetbrains.kotlin.backend.common.serialization.proto.IrClass.getDefaultInstance()) {
correspondingClass_ =
org.jetbrains.kotlin.backend.common.serialization.proto.IrClass.newBuilder(correspondingClass_).mergeFrom(value).buildPartial();
@@ -601,48 +633,16 @@ public final class IrEnumEntry extends
correspondingClass_ = value;
}
bitField0_ |= 0x00000004;
bitField0_ |= 0x00000008;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrClass corresponding_class = 3;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrClass corresponding_class = 4;</code>
*/
public Builder clearCorrespondingClass() {
correspondingClass_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrClass.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000004);
return this;
}
private int name_ ;
/**
* <code>required int32 name = 4;</code>
*/
public boolean hasName() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>required int32 name = 4;</code>
*/
public int getName() {
return name_;
}
/**
* <code>required int32 name = 4;</code>
*/
public Builder setName(int value) {
bitField0_ |= 0x00000008;
name_ = value;
return this;
}
/**
* <code>required int32 name = 4;</code>
*/
public Builder clearName() {
bitField0_ = (bitField0_ & ~0x00000008);
name_ = 0;
return this;
}
@@ -17,29 +17,29 @@ public interface IrEnumEntryOrBuilder extends
org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationBase getBase();
/**
* <code>optional int32 initializer = 2;</code>
* <code>required int32 name = 2;</code>
*/
boolean hasName();
/**
* <code>required int32 name = 2;</code>
*/
int getName();
/**
* <code>optional int32 initializer = 3;</code>
*/
boolean hasInitializer();
/**
* <code>optional int32 initializer = 2;</code>
* <code>optional int32 initializer = 3;</code>
*/
int getInitializer();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrClass corresponding_class = 3;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrClass corresponding_class = 4;</code>
*/
boolean hasCorrespondingClass();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrClass corresponding_class = 3;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrClass corresponding_class = 4;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.IrClass getCorrespondingClass();
/**
* <code>required int32 name = 4;</code>
*/
boolean hasName();
/**
* <code>required int32 name = 4;</code>
*/
int getName();
}
@@ -71,17 +71,9 @@ public final class IrExpression extends
type_ = input.readInt32();
break;
}
case 26: {
org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates.Builder subBuilder = null;
if (((bitField0_ & 0x00000004) == 0x00000004)) {
subBuilder = coordinates_.toBuilder();
}
coordinates_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(coordinates_);
coordinates_ = subBuilder.buildPartial();
}
case 24: {
bitField0_ |= 0x00000004;
coordinates_ = input.readInt64();
break;
}
}
@@ -149,24 +141,24 @@ public final class IrExpression extends
}
public static final int COORDINATES_FIELD_NUMBER = 3;
private org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates coordinates_;
private long coordinates_;
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates coordinates = 3;</code>
* <code>required int64 coordinates = 3;</code>
*/
public boolean hasCoordinates() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates coordinates = 3;</code>
* <code>required int64 coordinates = 3;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates getCoordinates() {
public long getCoordinates() {
return coordinates_;
}
private void initFields() {
operation_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrOperation.getDefaultInstance();
type_ = 0;
coordinates_ = org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates.getDefaultInstance();
coordinates_ = 0L;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
@@ -190,10 +182,6 @@ public final class IrExpression extends
memoizedIsInitialized = 0;
return false;
}
if (!getCoordinates().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1;
return true;
}
@@ -208,7 +196,7 @@ public final class IrExpression extends
output.writeInt32(2, type_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeMessage(3, coordinates_);
output.writeInt64(3, coordinates_);
}
output.writeRawBytes(unknownFields);
}
@@ -229,7 +217,7 @@ public final class IrExpression extends
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(3, coordinates_);
.computeInt64Size(3, coordinates_);
}
size += unknownFields.size();
memoizedSerializedSize = size;
@@ -329,7 +317,7 @@ public final class IrExpression extends
bitField0_ = (bitField0_ & ~0x00000001);
type_ = 0;
bitField0_ = (bitField0_ & ~0x00000002);
coordinates_ = org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates.getDefaultInstance();
coordinates_ = 0L;
bitField0_ = (bitField0_ & ~0x00000004);
return this;
}
@@ -379,7 +367,7 @@ public final class IrExpression extends
setType(other.getType());
}
if (other.hasCoordinates()) {
mergeCoordinates(other.getCoordinates());
setCoordinates(other.getCoordinates());
}
setUnknownFields(
getUnknownFields().concat(other.unknownFields));
@@ -403,10 +391,6 @@ public final class IrExpression extends
return false;
}
if (!getCoordinates().isInitialized()) {
return false;
}
return true;
}
@@ -521,63 +505,35 @@ public final class IrExpression extends
return this;
}
private org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates coordinates_ = org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates.getDefaultInstance();
private long coordinates_ ;
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates coordinates = 3;</code>
* <code>required int64 coordinates = 3;</code>
*/
public boolean hasCoordinates() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates coordinates = 3;</code>
* <code>required int64 coordinates = 3;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates getCoordinates() {
public long getCoordinates() {
return coordinates_;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates coordinates = 3;</code>
* <code>required int64 coordinates = 3;</code>
*/
public Builder setCoordinates(org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates value) {
if (value == null) {
throw new NullPointerException();
}
public Builder setCoordinates(long value) {
bitField0_ |= 0x00000004;
coordinates_ = value;
bitField0_ |= 0x00000004;
return this;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates coordinates = 3;</code>
*/
public Builder setCoordinates(
org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates.Builder builderForValue) {
coordinates_ = builderForValue.build();
bitField0_ |= 0x00000004;
return this;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates coordinates = 3;</code>
*/
public Builder mergeCoordinates(org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates value) {
if (((bitField0_ & 0x00000004) == 0x00000004) &&
coordinates_ != org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates.getDefaultInstance()) {
coordinates_ =
org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates.newBuilder(coordinates_).mergeFrom(value).buildPartial();
} else {
coordinates_ = value;
}
bitField0_ |= 0x00000004;
return this;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates coordinates = 3;</code>
* <code>required int64 coordinates = 3;</code>
*/
public Builder clearCoordinates() {
coordinates_ = org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000004);
coordinates_ = 0L;
return this;
}
@@ -26,11 +26,11 @@ public interface IrExpressionOrBuilder extends
int getType();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates coordinates = 3;</code>
* <code>required int64 coordinates = 3;</code>
*/
boolean hasCoordinates();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates coordinates = 3;</code>
* <code>required int64 coordinates = 3;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates getCoordinates();
long getCoordinates();
}
@@ -68,50 +68,12 @@ public final class IrField extends
}
case 16: {
bitField0_ |= 0x00000002;
initializer_ = input.readInt32();
nameType_ = input.readInt64();
break;
}
case 24: {
bitField0_ |= 0x00000004;
name_ = input.readInt32();
break;
}
case 34: {
org.jetbrains.kotlin.backend.common.serialization.proto.Visibility.Builder subBuilder = null;
if (((bitField0_ & 0x00000008) == 0x00000008)) {
subBuilder = visibility_.toBuilder();
}
visibility_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.Visibility.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(visibility_);
visibility_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000008;
break;
}
case 40: {
bitField0_ |= 0x00000010;
isFinal_ = input.readBool();
break;
}
case 48: {
bitField0_ |= 0x00000020;
isExternal_ = input.readBool();
break;
}
case 56: {
bitField0_ |= 0x00000040;
isStatic_ = input.readBool();
break;
}
case 64: {
bitField0_ |= 0x00000080;
type_ = input.readInt32();
break;
}
case 72: {
bitField0_ |= 0x00000100;
isFakeOverride_ = input.readBool();
initializer_ = input.readInt32();
break;
}
}
@@ -163,136 +125,40 @@ public final class IrField extends
return base_;
}
public static final int INITIALIZER_FIELD_NUMBER = 2;
private int initializer_;
public static final int NAME_TYPE_FIELD_NUMBER = 2;
private long nameType_;
/**
* <code>optional int32 initializer = 2;</code>
* <code>required int64 name_type = 2;</code>
*/
public boolean hasInitializer() {
public boolean hasNameType() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>optional int32 initializer = 2;</code>
* <code>required int64 name_type = 2;</code>
*/
public long getNameType() {
return nameType_;
}
public static final int INITIALIZER_FIELD_NUMBER = 3;
private int initializer_;
/**
* <code>optional int32 initializer = 3;</code>
*/
public boolean hasInitializer() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>optional int32 initializer = 3;</code>
*/
public int getInitializer() {
return initializer_;
}
public static final int NAME_FIELD_NUMBER = 3;
private int name_;
/**
* <code>required int32 name = 3;</code>
*/
public boolean hasName() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required int32 name = 3;</code>
*/
public int getName() {
return name_;
}
public static final int VISIBILITY_FIELD_NUMBER = 4;
private org.jetbrains.kotlin.backend.common.serialization.proto.Visibility visibility_;
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Visibility visibility = 4;</code>
*/
public boolean hasVisibility() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Visibility visibility = 4;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.Visibility getVisibility() {
return visibility_;
}
public static final int IS_FINAL_FIELD_NUMBER = 5;
private boolean isFinal_;
/**
* <code>required bool is_final = 5;</code>
*/
public boolean hasIsFinal() {
return ((bitField0_ & 0x00000010) == 0x00000010);
}
/**
* <code>required bool is_final = 5;</code>
*/
public boolean getIsFinal() {
return isFinal_;
}
public static final int IS_EXTERNAL_FIELD_NUMBER = 6;
private boolean isExternal_;
/**
* <code>required bool is_external = 6;</code>
*/
public boolean hasIsExternal() {
return ((bitField0_ & 0x00000020) == 0x00000020);
}
/**
* <code>required bool is_external = 6;</code>
*/
public boolean getIsExternal() {
return isExternal_;
}
public static final int IS_STATIC_FIELD_NUMBER = 7;
private boolean isStatic_;
/**
* <code>required bool is_static = 7;</code>
*/
public boolean hasIsStatic() {
return ((bitField0_ & 0x00000040) == 0x00000040);
}
/**
* <code>required bool is_static = 7;</code>
*/
public boolean getIsStatic() {
return isStatic_;
}
public static final int TYPE_FIELD_NUMBER = 8;
private int type_;
/**
* <code>required int32 type = 8;</code>
*/
public boolean hasType() {
return ((bitField0_ & 0x00000080) == 0x00000080);
}
/**
* <code>required int32 type = 8;</code>
*/
public int getType() {
return type_;
}
public static final int IS_FAKE_OVERRIDE_FIELD_NUMBER = 9;
private boolean isFakeOverride_;
/**
* <code>required bool is_fake_override = 9;</code>
*/
public boolean hasIsFakeOverride() {
return ((bitField0_ & 0x00000100) == 0x00000100);
}
/**
* <code>required bool is_fake_override = 9;</code>
*/
public boolean getIsFakeOverride() {
return isFakeOverride_;
}
private void initFields() {
base_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationBase.getDefaultInstance();
nameType_ = 0L;
initializer_ = 0;
name_ = 0;
visibility_ = org.jetbrains.kotlin.backend.common.serialization.proto.Visibility.getDefaultInstance();
isFinal_ = false;
isExternal_ = false;
isStatic_ = false;
type_ = 0;
isFakeOverride_ = false;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
@@ -304,31 +170,7 @@ public final class IrField extends
memoizedIsInitialized = 0;
return false;
}
if (!hasName()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasVisibility()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasIsFinal()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasIsExternal()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasIsStatic()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasType()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasIsFakeOverride()) {
if (!hasNameType()) {
memoizedIsInitialized = 0;
return false;
}
@@ -336,10 +178,6 @@ public final class IrField extends
memoizedIsInitialized = 0;
return false;
}
if (!getVisibility().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1;
return true;
}
@@ -351,28 +189,10 @@ public final class IrField extends
output.writeMessage(1, base_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeInt32(2, initializer_);
output.writeInt64(2, nameType_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeInt32(3, name_);
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
output.writeMessage(4, visibility_);
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
output.writeBool(5, isFinal_);
}
if (((bitField0_ & 0x00000020) == 0x00000020)) {
output.writeBool(6, isExternal_);
}
if (((bitField0_ & 0x00000040) == 0x00000040)) {
output.writeBool(7, isStatic_);
}
if (((bitField0_ & 0x00000080) == 0x00000080)) {
output.writeInt32(8, type_);
}
if (((bitField0_ & 0x00000100) == 0x00000100)) {
output.writeBool(9, isFakeOverride_);
output.writeInt32(3, initializer_);
}
output.writeRawBytes(unknownFields);
}
@@ -389,35 +209,11 @@ public final class IrField extends
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(2, initializer_);
.computeInt64Size(2, nameType_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(3, name_);
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(4, visibility_);
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeBoolSize(5, isFinal_);
}
if (((bitField0_ & 0x00000020) == 0x00000020)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeBoolSize(6, isExternal_);
}
if (((bitField0_ & 0x00000040) == 0x00000040)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeBoolSize(7, isStatic_);
}
if (((bitField0_ & 0x00000080) == 0x00000080)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(8, type_);
}
if (((bitField0_ & 0x00000100) == 0x00000100)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeBoolSize(9, isFakeOverride_);
.computeInt32Size(3, initializer_);
}
size += unknownFields.size();
memoizedSerializedSize = size;
@@ -515,22 +311,10 @@ public final class IrField extends
super.clear();
base_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationBase.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000001);
initializer_ = 0;
nameType_ = 0L;
bitField0_ = (bitField0_ & ~0x00000002);
name_ = 0;
initializer_ = 0;
bitField0_ = (bitField0_ & ~0x00000004);
visibility_ = org.jetbrains.kotlin.backend.common.serialization.proto.Visibility.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000008);
isFinal_ = false;
bitField0_ = (bitField0_ & ~0x00000010);
isExternal_ = false;
bitField0_ = (bitField0_ & ~0x00000020);
isStatic_ = false;
bitField0_ = (bitField0_ & ~0x00000040);
type_ = 0;
bitField0_ = (bitField0_ & ~0x00000080);
isFakeOverride_ = false;
bitField0_ = (bitField0_ & ~0x00000100);
return this;
}
@@ -561,35 +345,11 @@ public final class IrField extends
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.initializer_ = initializer_;
result.nameType_ = nameType_;
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
to_bitField0_ |= 0x00000004;
}
result.name_ = name_;
if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
to_bitField0_ |= 0x00000008;
}
result.visibility_ = visibility_;
if (((from_bitField0_ & 0x00000010) == 0x00000010)) {
to_bitField0_ |= 0x00000010;
}
result.isFinal_ = isFinal_;
if (((from_bitField0_ & 0x00000020) == 0x00000020)) {
to_bitField0_ |= 0x00000020;
}
result.isExternal_ = isExternal_;
if (((from_bitField0_ & 0x00000040) == 0x00000040)) {
to_bitField0_ |= 0x00000040;
}
result.isStatic_ = isStatic_;
if (((from_bitField0_ & 0x00000080) == 0x00000080)) {
to_bitField0_ |= 0x00000080;
}
result.type_ = type_;
if (((from_bitField0_ & 0x00000100) == 0x00000100)) {
to_bitField0_ |= 0x00000100;
}
result.isFakeOverride_ = isFakeOverride_;
result.initializer_ = initializer_;
result.bitField0_ = to_bitField0_;
return result;
}
@@ -599,30 +359,12 @@ public final class IrField extends
if (other.hasBase()) {
mergeBase(other.getBase());
}
if (other.hasNameType()) {
setNameType(other.getNameType());
}
if (other.hasInitializer()) {
setInitializer(other.getInitializer());
}
if (other.hasName()) {
setName(other.getName());
}
if (other.hasVisibility()) {
mergeVisibility(other.getVisibility());
}
if (other.hasIsFinal()) {
setIsFinal(other.getIsFinal());
}
if (other.hasIsExternal()) {
setIsExternal(other.getIsExternal());
}
if (other.hasIsStatic()) {
setIsStatic(other.getIsStatic());
}
if (other.hasType()) {
setType(other.getType());
}
if (other.hasIsFakeOverride()) {
setIsFakeOverride(other.getIsFakeOverride());
}
setUnknownFields(
getUnknownFields().concat(other.unknownFields));
return this;
@@ -633,31 +375,7 @@ public final class IrField extends
return false;
}
if (!hasName()) {
return false;
}
if (!hasVisibility()) {
return false;
}
if (!hasIsFinal()) {
return false;
}
if (!hasIsExternal()) {
return false;
}
if (!hasIsStatic()) {
return false;
}
if (!hasType()) {
return false;
}
if (!hasIsFakeOverride()) {
if (!hasNameType()) {
return false;
}
@@ -665,10 +383,6 @@ public final class IrField extends
return false;
}
if (!getVisibility().isInitialized()) {
return false;
}
return true;
}
@@ -751,286 +465,66 @@ public final class IrField extends
return this;
}
private int initializer_ ;
private long nameType_ ;
/**
* <code>optional int32 initializer = 2;</code>
* <code>required int64 name_type = 2;</code>
*/
public boolean hasInitializer() {
public boolean hasNameType() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>optional int32 initializer = 2;</code>
* <code>required int64 name_type = 2;</code>
*/
public long getNameType() {
return nameType_;
}
/**
* <code>required int64 name_type = 2;</code>
*/
public Builder setNameType(long value) {
bitField0_ |= 0x00000002;
nameType_ = value;
return this;
}
/**
* <code>required int64 name_type = 2;</code>
*/
public Builder clearNameType() {
bitField0_ = (bitField0_ & ~0x00000002);
nameType_ = 0L;
return this;
}
private int initializer_ ;
/**
* <code>optional int32 initializer = 3;</code>
*/
public boolean hasInitializer() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>optional int32 initializer = 3;</code>
*/
public int getInitializer() {
return initializer_;
}
/**
* <code>optional int32 initializer = 2;</code>
* <code>optional int32 initializer = 3;</code>
*/
public Builder setInitializer(int value) {
bitField0_ |= 0x00000002;
bitField0_ |= 0x00000004;
initializer_ = value;
return this;
}
/**
* <code>optional int32 initializer = 2;</code>
* <code>optional int32 initializer = 3;</code>
*/
public Builder clearInitializer() {
bitField0_ = (bitField0_ & ~0x00000002);
initializer_ = 0;
return this;
}
private int name_ ;
/**
* <code>required int32 name = 3;</code>
*/
public boolean hasName() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required int32 name = 3;</code>
*/
public int getName() {
return name_;
}
/**
* <code>required int32 name = 3;</code>
*/
public Builder setName(int value) {
bitField0_ |= 0x00000004;
name_ = value;
return this;
}
/**
* <code>required int32 name = 3;</code>
*/
public Builder clearName() {
bitField0_ = (bitField0_ & ~0x00000004);
name_ = 0;
return this;
}
private org.jetbrains.kotlin.backend.common.serialization.proto.Visibility visibility_ = org.jetbrains.kotlin.backend.common.serialization.proto.Visibility.getDefaultInstance();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Visibility visibility = 4;</code>
*/
public boolean hasVisibility() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Visibility visibility = 4;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.Visibility getVisibility() {
return visibility_;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Visibility visibility = 4;</code>
*/
public Builder setVisibility(org.jetbrains.kotlin.backend.common.serialization.proto.Visibility value) {
if (value == null) {
throw new NullPointerException();
}
visibility_ = value;
bitField0_ |= 0x00000008;
return this;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Visibility visibility = 4;</code>
*/
public Builder setVisibility(
org.jetbrains.kotlin.backend.common.serialization.proto.Visibility.Builder builderForValue) {
visibility_ = builderForValue.build();
bitField0_ |= 0x00000008;
return this;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Visibility visibility = 4;</code>
*/
public Builder mergeVisibility(org.jetbrains.kotlin.backend.common.serialization.proto.Visibility value) {
if (((bitField0_ & 0x00000008) == 0x00000008) &&
visibility_ != org.jetbrains.kotlin.backend.common.serialization.proto.Visibility.getDefaultInstance()) {
visibility_ =
org.jetbrains.kotlin.backend.common.serialization.proto.Visibility.newBuilder(visibility_).mergeFrom(value).buildPartial();
} else {
visibility_ = value;
}
bitField0_ |= 0x00000008;
return this;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Visibility visibility = 4;</code>
*/
public Builder clearVisibility() {
visibility_ = org.jetbrains.kotlin.backend.common.serialization.proto.Visibility.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000008);
return this;
}
private boolean isFinal_ ;
/**
* <code>required bool is_final = 5;</code>
*/
public boolean hasIsFinal() {
return ((bitField0_ & 0x00000010) == 0x00000010);
}
/**
* <code>required bool is_final = 5;</code>
*/
public boolean getIsFinal() {
return isFinal_;
}
/**
* <code>required bool is_final = 5;</code>
*/
public Builder setIsFinal(boolean value) {
bitField0_ |= 0x00000010;
isFinal_ = value;
return this;
}
/**
* <code>required bool is_final = 5;</code>
*/
public Builder clearIsFinal() {
bitField0_ = (bitField0_ & ~0x00000010);
isFinal_ = false;
return this;
}
private boolean isExternal_ ;
/**
* <code>required bool is_external = 6;</code>
*/
public boolean hasIsExternal() {
return ((bitField0_ & 0x00000020) == 0x00000020);
}
/**
* <code>required bool is_external = 6;</code>
*/
public boolean getIsExternal() {
return isExternal_;
}
/**
* <code>required bool is_external = 6;</code>
*/
public Builder setIsExternal(boolean value) {
bitField0_ |= 0x00000020;
isExternal_ = value;
return this;
}
/**
* <code>required bool is_external = 6;</code>
*/
public Builder clearIsExternal() {
bitField0_ = (bitField0_ & ~0x00000020);
isExternal_ = false;
return this;
}
private boolean isStatic_ ;
/**
* <code>required bool is_static = 7;</code>
*/
public boolean hasIsStatic() {
return ((bitField0_ & 0x00000040) == 0x00000040);
}
/**
* <code>required bool is_static = 7;</code>
*/
public boolean getIsStatic() {
return isStatic_;
}
/**
* <code>required bool is_static = 7;</code>
*/
public Builder setIsStatic(boolean value) {
bitField0_ |= 0x00000040;
isStatic_ = value;
return this;
}
/**
* <code>required bool is_static = 7;</code>
*/
public Builder clearIsStatic() {
bitField0_ = (bitField0_ & ~0x00000040);
isStatic_ = false;
return this;
}
private int type_ ;
/**
* <code>required int32 type = 8;</code>
*/
public boolean hasType() {
return ((bitField0_ & 0x00000080) == 0x00000080);
}
/**
* <code>required int32 type = 8;</code>
*/
public int getType() {
return type_;
}
/**
* <code>required int32 type = 8;</code>
*/
public Builder setType(int value) {
bitField0_ |= 0x00000080;
type_ = value;
return this;
}
/**
* <code>required int32 type = 8;</code>
*/
public Builder clearType() {
bitField0_ = (bitField0_ & ~0x00000080);
type_ = 0;
return this;
}
private boolean isFakeOverride_ ;
/**
* <code>required bool is_fake_override = 9;</code>
*/
public boolean hasIsFakeOverride() {
return ((bitField0_ & 0x00000100) == 0x00000100);
}
/**
* <code>required bool is_fake_override = 9;</code>
*/
public boolean getIsFakeOverride() {
return isFakeOverride_;
}
/**
* <code>required bool is_fake_override = 9;</code>
*/
public Builder setIsFakeOverride(boolean value) {
bitField0_ |= 0x00000100;
isFakeOverride_ = value;
return this;
}
/**
* <code>required bool is_fake_override = 9;</code>
*/
public Builder clearIsFakeOverride() {
bitField0_ = (bitField0_ & ~0x00000100);
isFakeOverride_ = false;
initializer_ = 0;
return this;
}
@@ -17,74 +17,20 @@ public interface IrFieldOrBuilder extends
org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationBase getBase();
/**
* <code>optional int32 initializer = 2;</code>
* <code>required int64 name_type = 2;</code>
*/
boolean hasNameType();
/**
* <code>required int64 name_type = 2;</code>
*/
long getNameType();
/**
* <code>optional int32 initializer = 3;</code>
*/
boolean hasInitializer();
/**
* <code>optional int32 initializer = 2;</code>
* <code>optional int32 initializer = 3;</code>
*/
int getInitializer();
/**
* <code>required int32 name = 3;</code>
*/
boolean hasName();
/**
* <code>required int32 name = 3;</code>
*/
int getName();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Visibility visibility = 4;</code>
*/
boolean hasVisibility();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Visibility visibility = 4;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.Visibility getVisibility();
/**
* <code>required bool is_final = 5;</code>
*/
boolean hasIsFinal();
/**
* <code>required bool is_final = 5;</code>
*/
boolean getIsFinal();
/**
* <code>required bool is_external = 6;</code>
*/
boolean hasIsExternal();
/**
* <code>required bool is_external = 6;</code>
*/
boolean getIsExternal();
/**
* <code>required bool is_static = 7;</code>
*/
boolean hasIsStatic();
/**
* <code>required bool is_static = 7;</code>
*/
boolean getIsStatic();
/**
* <code>required int32 type = 8;</code>
*/
boolean hasType();
/**
* <code>required int32 type = 8;</code>
*/
int getType();
/**
* <code>required bool is_fake_override = 9;</code>
*/
boolean hasIsFakeOverride();
/**
* <code>required bool is_fake_override = 9;</code>
*/
boolean getIsFakeOverride();
}
@@ -55,21 +55,21 @@ public final class IrFile extends
}
case 8: {
if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
declarationId_ = new java.util.ArrayList<java.lang.Long>();
declarationId_ = new java.util.ArrayList<java.lang.Integer>();
mutable_bitField0_ |= 0x00000001;
}
declarationId_.add(input.readInt64());
declarationId_.add(input.readInt32());
break;
}
case 10: {
int length = input.readRawVarint32();
int limit = input.pushLimit(length);
if (!((mutable_bitField0_ & 0x00000001) == 0x00000001) && input.getBytesUntilLimit() > 0) {
declarationId_ = new java.util.ArrayList<java.lang.Long>();
declarationId_ = new java.util.ArrayList<java.lang.Integer>();
mutable_bitField0_ |= 0x00000001;
}
while (input.getBytesUntilLimit() > 0) {
declarationId_.add(input.readInt64());
declarationId_.add(input.readInt32());
}
input.popLimit(limit);
break;
@@ -118,21 +118,21 @@ public final class IrFile extends
}
case 40: {
if (!((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
explicitlyExportedToCompiler_ = new java.util.ArrayList<java.lang.Integer>();
explicitlyExportedToCompiler_ = new java.util.ArrayList<java.lang.Long>();
mutable_bitField0_ |= 0x00000010;
}
explicitlyExportedToCompiler_.add(input.readInt32());
explicitlyExportedToCompiler_.add(input.readInt64());
break;
}
case 42: {
int length = input.readRawVarint32();
int limit = input.pushLimit(length);
if (!((mutable_bitField0_ & 0x00000010) == 0x00000010) && input.getBytesUntilLimit() > 0) {
explicitlyExportedToCompiler_ = new java.util.ArrayList<java.lang.Integer>();
explicitlyExportedToCompiler_ = new java.util.ArrayList<java.lang.Long>();
mutable_bitField0_ |= 0x00000010;
}
while (input.getBytesUntilLimit() > 0) {
explicitlyExportedToCompiler_.add(input.readInt32());
explicitlyExportedToCompiler_.add(input.readInt64());
}
input.popLimit(limit);
break;
@@ -195,26 +195,27 @@ public final class IrFile extends
private int bitField0_;
public static final int DECLARATION_ID_FIELD_NUMBER = 1;
private java.util.List<java.lang.Long> declarationId_;
private java.util.List<java.lang.Integer> declarationId_;
/**
* <code>repeated int64 declaration_id = 1;</code>
* <code>repeated int32 declaration_id = 1 [packed = true];</code>
*/
public java.util.List<java.lang.Long>
public java.util.List<java.lang.Integer>
getDeclarationIdList() {
return declarationId_;
}
/**
* <code>repeated int64 declaration_id = 1;</code>
* <code>repeated int32 declaration_id = 1 [packed = true];</code>
*/
public int getDeclarationIdCount() {
return declarationId_.size();
}
/**
* <code>repeated int64 declaration_id = 1;</code>
* <code>repeated int32 declaration_id = 1 [packed = true];</code>
*/
public long getDeclarationId(int index) {
public int getDeclarationId(int index) {
return declarationId_.get(index);
}
private int declarationIdMemoizedSerializedSize = -1;
public static final int FILE_ENTRY_FIELD_NUMBER = 2;
private org.jetbrains.kotlin.backend.common.serialization.proto.FileEntry fileEntry_;
@@ -234,24 +235,25 @@ public final class IrFile extends
public static final int FQ_NAME_FIELD_NUMBER = 3;
private java.util.List<java.lang.Integer> fqName_;
/**
* <code>repeated int32 fq_name = 3;</code>
* <code>repeated int32 fq_name = 3 [packed = true];</code>
*/
public java.util.List<java.lang.Integer>
getFqNameList() {
return fqName_;
}
/**
* <code>repeated int32 fq_name = 3;</code>
* <code>repeated int32 fq_name = 3 [packed = true];</code>
*/
public int getFqNameCount() {
return fqName_.size();
}
/**
* <code>repeated int32 fq_name = 3;</code>
* <code>repeated int32 fq_name = 3 [packed = true];</code>
*/
public int getFqName(int index) {
return fqName_.get(index);
}
private int fqNameMemoizedSerializedSize = -1;
public static final int ANNOTATION_FIELD_NUMBER = 4;
private java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall> annotation_;
@@ -289,26 +291,27 @@ public final class IrFile extends
}
public static final int EXPLICITLY_EXPORTED_TO_COMPILER_FIELD_NUMBER = 5;
private java.util.List<java.lang.Integer> explicitlyExportedToCompiler_;
private java.util.List<java.lang.Long> explicitlyExportedToCompiler_;
/**
* <code>repeated int32 explicitly_exported_to_compiler = 5;</code>
* <code>repeated int64 explicitly_exported_to_compiler = 5 [packed = true];</code>
*/
public java.util.List<java.lang.Integer>
public java.util.List<java.lang.Long>
getExplicitlyExportedToCompilerList() {
return explicitlyExportedToCompiler_;
}
/**
* <code>repeated int32 explicitly_exported_to_compiler = 5;</code>
* <code>repeated int64 explicitly_exported_to_compiler = 5 [packed = true];</code>
*/
public int getExplicitlyExportedToCompilerCount() {
return explicitlyExportedToCompiler_.size();
}
/**
* <code>repeated int32 explicitly_exported_to_compiler = 5;</code>
* <code>repeated int64 explicitly_exported_to_compiler = 5 [packed = true];</code>
*/
public int getExplicitlyExportedToCompiler(int index) {
public long getExplicitlyExportedToCompiler(int index) {
return explicitlyExportedToCompiler_.get(index);
}
private int explicitlyExportedToCompilerMemoizedSerializedSize = -1;
public static final int ACTUALS_FIELD_NUMBER = 6;
private java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.Actual> actuals_;
@@ -386,20 +389,32 @@ public final class IrFile extends
public void writeTo(org.jetbrains.kotlin.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (getDeclarationIdList().size() > 0) {
output.writeRawVarint32(10);
output.writeRawVarint32(declarationIdMemoizedSerializedSize);
}
for (int i = 0; i < declarationId_.size(); i++) {
output.writeInt64(1, declarationId_.get(i));
output.writeInt32NoTag(declarationId_.get(i));
}
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeMessage(2, fileEntry_);
}
if (getFqNameList().size() > 0) {
output.writeRawVarint32(26);
output.writeRawVarint32(fqNameMemoizedSerializedSize);
}
for (int i = 0; i < fqName_.size(); i++) {
output.writeInt32(3, fqName_.get(i));
output.writeInt32NoTag(fqName_.get(i));
}
for (int i = 0; i < annotation_.size(); i++) {
output.writeMessage(4, annotation_.get(i));
}
if (getExplicitlyExportedToCompilerList().size() > 0) {
output.writeRawVarint32(42);
output.writeRawVarint32(explicitlyExportedToCompilerMemoizedSerializedSize);
}
for (int i = 0; i < explicitlyExportedToCompiler_.size(); i++) {
output.writeInt32(5, explicitlyExportedToCompiler_.get(i));
output.writeInt64NoTag(explicitlyExportedToCompiler_.get(i));
}
for (int i = 0; i < actuals_.size(); i++) {
output.writeMessage(6, actuals_.get(i));
@@ -417,10 +432,15 @@ public final class IrFile extends
int dataSize = 0;
for (int i = 0; i < declarationId_.size(); i++) {
dataSize += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt64SizeNoTag(declarationId_.get(i));
.computeInt32SizeNoTag(declarationId_.get(i));
}
size += dataSize;
size += 1 * getDeclarationIdList().size();
if (!getDeclarationIdList().isEmpty()) {
size += 1;
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32SizeNoTag(dataSize);
}
declarationIdMemoizedSerializedSize = dataSize;
}
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
@@ -433,7 +453,12 @@ public final class IrFile extends
.computeInt32SizeNoTag(fqName_.get(i));
}
size += dataSize;
size += 1 * getFqNameList().size();
if (!getFqNameList().isEmpty()) {
size += 1;
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32SizeNoTag(dataSize);
}
fqNameMemoizedSerializedSize = dataSize;
}
for (int i = 0; i < annotation_.size(); i++) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
@@ -443,10 +468,15 @@ public final class IrFile extends
int dataSize = 0;
for (int i = 0; i < explicitlyExportedToCompiler_.size(); i++) {
dataSize += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32SizeNoTag(explicitlyExportedToCompiler_.get(i));
.computeInt64SizeNoTag(explicitlyExportedToCompiler_.get(i));
}
size += dataSize;
size += 1 * getExplicitlyExportedToCompilerList().size();
if (!getExplicitlyExportedToCompilerList().isEmpty()) {
size += 1;
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32SizeNoTag(dataSize);
}
explicitlyExportedToCompilerMemoizedSerializedSize = dataSize;
}
for (int i = 0; i < actuals_.size(); i++) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
@@ -717,56 +747,56 @@ public final class IrFile extends
}
private int bitField0_;
private java.util.List<java.lang.Long> declarationId_ = java.util.Collections.emptyList();
private java.util.List<java.lang.Integer> declarationId_ = java.util.Collections.emptyList();
private void ensureDeclarationIdIsMutable() {
if (!((bitField0_ & 0x00000001) == 0x00000001)) {
declarationId_ = new java.util.ArrayList<java.lang.Long>(declarationId_);
declarationId_ = new java.util.ArrayList<java.lang.Integer>(declarationId_);
bitField0_ |= 0x00000001;
}
}
/**
* <code>repeated int64 declaration_id = 1;</code>
* <code>repeated int32 declaration_id = 1 [packed = true];</code>
*/
public java.util.List<java.lang.Long>
public java.util.List<java.lang.Integer>
getDeclarationIdList() {
return java.util.Collections.unmodifiableList(declarationId_);
}
/**
* <code>repeated int64 declaration_id = 1;</code>
* <code>repeated int32 declaration_id = 1 [packed = true];</code>
*/
public int getDeclarationIdCount() {
return declarationId_.size();
}
/**
* <code>repeated int64 declaration_id = 1;</code>
* <code>repeated int32 declaration_id = 1 [packed = true];</code>
*/
public long getDeclarationId(int index) {
public int getDeclarationId(int index) {
return declarationId_.get(index);
}
/**
* <code>repeated int64 declaration_id = 1;</code>
* <code>repeated int32 declaration_id = 1 [packed = true];</code>
*/
public Builder setDeclarationId(
int index, long value) {
int index, int value) {
ensureDeclarationIdIsMutable();
declarationId_.set(index, value);
return this;
}
/**
* <code>repeated int64 declaration_id = 1;</code>
* <code>repeated int32 declaration_id = 1 [packed = true];</code>
*/
public Builder addDeclarationId(long value) {
public Builder addDeclarationId(int value) {
ensureDeclarationIdIsMutable();
declarationId_.add(value);
return this;
}
/**
* <code>repeated int64 declaration_id = 1;</code>
* <code>repeated int32 declaration_id = 1 [packed = true];</code>
*/
public Builder addAllDeclarationId(
java.lang.Iterable<? extends java.lang.Long> values) {
java.lang.Iterable<? extends java.lang.Integer> values) {
ensureDeclarationIdIsMutable();
org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll(
values, declarationId_);
@@ -774,7 +804,7 @@ public final class IrFile extends
return this;
}
/**
* <code>repeated int64 declaration_id = 1;</code>
* <code>repeated int32 declaration_id = 1 [packed = true];</code>
*/
public Builder clearDeclarationId() {
declarationId_ = java.util.Collections.emptyList();
@@ -851,26 +881,26 @@ public final class IrFile extends
}
}
/**
* <code>repeated int32 fq_name = 3;</code>
* <code>repeated int32 fq_name = 3 [packed = true];</code>
*/
public java.util.List<java.lang.Integer>
getFqNameList() {
return java.util.Collections.unmodifiableList(fqName_);
}
/**
* <code>repeated int32 fq_name = 3;</code>
* <code>repeated int32 fq_name = 3 [packed = true];</code>
*/
public int getFqNameCount() {
return fqName_.size();
}
/**
* <code>repeated int32 fq_name = 3;</code>
* <code>repeated int32 fq_name = 3 [packed = true];</code>
*/
public int getFqName(int index) {
return fqName_.get(index);
}
/**
* <code>repeated int32 fq_name = 3;</code>
* <code>repeated int32 fq_name = 3 [packed = true];</code>
*/
public Builder setFqName(
int index, int value) {
@@ -880,7 +910,7 @@ public final class IrFile extends
return this;
}
/**
* <code>repeated int32 fq_name = 3;</code>
* <code>repeated int32 fq_name = 3 [packed = true];</code>
*/
public Builder addFqName(int value) {
ensureFqNameIsMutable();
@@ -889,7 +919,7 @@ public final class IrFile extends
return this;
}
/**
* <code>repeated int32 fq_name = 3;</code>
* <code>repeated int32 fq_name = 3 [packed = true];</code>
*/
public Builder addAllFqName(
java.lang.Iterable<? extends java.lang.Integer> values) {
@@ -900,7 +930,7 @@ public final class IrFile extends
return this;
}
/**
* <code>repeated int32 fq_name = 3;</code>
* <code>repeated int32 fq_name = 3 [packed = true];</code>
*/
public Builder clearFqName() {
fqName_ = java.util.Collections.emptyList();
@@ -1034,56 +1064,56 @@ public final class IrFile extends
return this;
}
private java.util.List<java.lang.Integer> explicitlyExportedToCompiler_ = java.util.Collections.emptyList();
private java.util.List<java.lang.Long> explicitlyExportedToCompiler_ = java.util.Collections.emptyList();
private void ensureExplicitlyExportedToCompilerIsMutable() {
if (!((bitField0_ & 0x00000010) == 0x00000010)) {
explicitlyExportedToCompiler_ = new java.util.ArrayList<java.lang.Integer>(explicitlyExportedToCompiler_);
explicitlyExportedToCompiler_ = new java.util.ArrayList<java.lang.Long>(explicitlyExportedToCompiler_);
bitField0_ |= 0x00000010;
}
}
/**
* <code>repeated int32 explicitly_exported_to_compiler = 5;</code>
* <code>repeated int64 explicitly_exported_to_compiler = 5 [packed = true];</code>
*/
public java.util.List<java.lang.Integer>
public java.util.List<java.lang.Long>
getExplicitlyExportedToCompilerList() {
return java.util.Collections.unmodifiableList(explicitlyExportedToCompiler_);
}
/**
* <code>repeated int32 explicitly_exported_to_compiler = 5;</code>
* <code>repeated int64 explicitly_exported_to_compiler = 5 [packed = true];</code>
*/
public int getExplicitlyExportedToCompilerCount() {
return explicitlyExportedToCompiler_.size();
}
/**
* <code>repeated int32 explicitly_exported_to_compiler = 5;</code>
* <code>repeated int64 explicitly_exported_to_compiler = 5 [packed = true];</code>
*/
public int getExplicitlyExportedToCompiler(int index) {
public long getExplicitlyExportedToCompiler(int index) {
return explicitlyExportedToCompiler_.get(index);
}
/**
* <code>repeated int32 explicitly_exported_to_compiler = 5;</code>
* <code>repeated int64 explicitly_exported_to_compiler = 5 [packed = true];</code>
*/
public Builder setExplicitlyExportedToCompiler(
int index, int value) {
int index, long value) {
ensureExplicitlyExportedToCompilerIsMutable();
explicitlyExportedToCompiler_.set(index, value);
return this;
}
/**
* <code>repeated int32 explicitly_exported_to_compiler = 5;</code>
* <code>repeated int64 explicitly_exported_to_compiler = 5 [packed = true];</code>
*/
public Builder addExplicitlyExportedToCompiler(int value) {
public Builder addExplicitlyExportedToCompiler(long value) {
ensureExplicitlyExportedToCompilerIsMutable();
explicitlyExportedToCompiler_.add(value);
return this;
}
/**
* <code>repeated int32 explicitly_exported_to_compiler = 5;</code>
* <code>repeated int64 explicitly_exported_to_compiler = 5 [packed = true];</code>
*/
public Builder addAllExplicitlyExportedToCompiler(
java.lang.Iterable<? extends java.lang.Integer> values) {
java.lang.Iterable<? extends java.lang.Long> values) {
ensureExplicitlyExportedToCompilerIsMutable();
org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll(
values, explicitlyExportedToCompiler_);
@@ -1091,7 +1121,7 @@ public final class IrFile extends
return this;
}
/**
* <code>repeated int32 explicitly_exported_to_compiler = 5;</code>
* <code>repeated int64 explicitly_exported_to_compiler = 5 [packed = true];</code>
*/
public Builder clearExplicitlyExportedToCompiler() {
explicitlyExportedToCompiler_ = java.util.Collections.emptyList();
@@ -8,17 +8,17 @@ public interface IrFileOrBuilder extends
org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder {
/**
* <code>repeated int64 declaration_id = 1;</code>
* <code>repeated int32 declaration_id = 1 [packed = true];</code>
*/
java.util.List<java.lang.Long> getDeclarationIdList();
java.util.List<java.lang.Integer> getDeclarationIdList();
/**
* <code>repeated int64 declaration_id = 1;</code>
* <code>repeated int32 declaration_id = 1 [packed = true];</code>
*/
int getDeclarationIdCount();
/**
* <code>repeated int64 declaration_id = 1;</code>
* <code>repeated int32 declaration_id = 1 [packed = true];</code>
*/
long getDeclarationId(int index);
int getDeclarationId(int index);
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.FileEntry file_entry = 2;</code>
@@ -30,15 +30,15 @@ public interface IrFileOrBuilder extends
org.jetbrains.kotlin.backend.common.serialization.proto.FileEntry getFileEntry();
/**
* <code>repeated int32 fq_name = 3;</code>
* <code>repeated int32 fq_name = 3 [packed = true];</code>
*/
java.util.List<java.lang.Integer> getFqNameList();
/**
* <code>repeated int32 fq_name = 3;</code>
* <code>repeated int32 fq_name = 3 [packed = true];</code>
*/
int getFqNameCount();
/**
* <code>repeated int32 fq_name = 3;</code>
* <code>repeated int32 fq_name = 3 [packed = true];</code>
*/
int getFqName(int index);
@@ -57,17 +57,17 @@ public interface IrFileOrBuilder extends
int getAnnotationCount();
/**
* <code>repeated int32 explicitly_exported_to_compiler = 5;</code>
* <code>repeated int64 explicitly_exported_to_compiler = 5 [packed = true];</code>
*/
java.util.List<java.lang.Integer> getExplicitlyExportedToCompilerList();
java.util.List<java.lang.Long> getExplicitlyExportedToCompilerList();
/**
* <code>repeated int32 explicitly_exported_to_compiler = 5;</code>
* <code>repeated int64 explicitly_exported_to_compiler = 5 [packed = true];</code>
*/
int getExplicitlyExportedToCompilerCount();
/**
* <code>repeated int32 explicitly_exported_to_compiler = 5;</code>
* <code>repeated int64 explicitly_exported_to_compiler = 5 [packed = true];</code>
*/
int getExplicitlyExportedToCompiler(int index);
long getExplicitlyExportedToCompiler(int index);
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actuals = 6;</code>
@@ -67,58 +67,26 @@ public final class IrFunction extends
break;
}
case 16: {
int rawValue = input.readEnum();
org.jetbrains.kotlin.backend.common.serialization.proto.ModalityKind value = org.jetbrains.kotlin.backend.common.serialization.proto.ModalityKind.valueOf(rawValue);
if (value == null) {
unknownFieldsCodedOutput.writeRawVarint32(tag);
unknownFieldsCodedOutput.writeRawVarint32(rawValue);
} else {
bitField0_ |= 0x00000002;
modality_ = value;
if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
overridden_ = new java.util.ArrayList<java.lang.Long>();
mutable_bitField0_ |= 0x00000002;
}
overridden_.add(input.readInt64());
break;
}
case 24: {
bitField0_ |= 0x00000004;
isTailrec_ = input.readBool();
break;
}
case 32: {
bitField0_ |= 0x00000008;
isSuspend_ = input.readBool();
break;
}
case 40: {
if (!((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
overridden_ = new java.util.ArrayList<java.lang.Integer>();
mutable_bitField0_ |= 0x00000010;
}
overridden_.add(input.readInt32());
break;
}
case 42: {
case 18: {
int length = input.readRawVarint32();
int limit = input.pushLimit(length);
if (!((mutable_bitField0_ & 0x00000010) == 0x00000010) && input.getBytesUntilLimit() > 0) {
overridden_ = new java.util.ArrayList<java.lang.Integer>();
mutable_bitField0_ |= 0x00000010;
if (!((mutable_bitField0_ & 0x00000002) == 0x00000002) && input.getBytesUntilLimit() > 0) {
overridden_ = new java.util.ArrayList<java.lang.Long>();
mutable_bitField0_ |= 0x00000002;
}
while (input.getBytesUntilLimit() > 0) {
overridden_.add(input.readInt32());
overridden_.add(input.readInt64());
}
input.popLimit(limit);
break;
}
case 64: {
bitField0_ |= 0x00000010;
isFakeOverride_ = input.readBool();
break;
}
case 72: {
bitField0_ |= 0x00000020;
isOperator_ = input.readBool();
break;
}
}
}
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
@@ -127,7 +95,7 @@ public final class IrFunction extends
throw new org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
overridden_ = java.util.Collections.unmodifiableList(overridden_);
}
try {
@@ -171,119 +139,44 @@ public final class IrFunction extends
return base_;
}
public static final int MODALITY_FIELD_NUMBER = 2;
private org.jetbrains.kotlin.backend.common.serialization.proto.ModalityKind modality_;
public static final int OVERRIDDEN_FIELD_NUMBER = 2;
private java.util.List<java.lang.Long> overridden_;
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.ModalityKind modality = 2;</code>
* <code>repeated int64 overridden = 2 [packed = true];</code>
*
* <pre>
* TODO: supposed to be deleted
* </pre>
*/
public boolean hasModality() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.ModalityKind modality = 2;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.ModalityKind getModality() {
return modality_;
}
public static final int IS_TAILREC_FIELD_NUMBER = 3;
private boolean isTailrec_;
/**
* <code>required bool is_tailrec = 3;</code>
*/
public boolean hasIsTailrec() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required bool is_tailrec = 3;</code>
*/
public boolean getIsTailrec() {
return isTailrec_;
}
public static final int IS_SUSPEND_FIELD_NUMBER = 4;
private boolean isSuspend_;
/**
* <code>required bool is_suspend = 4;</code>
*/
public boolean hasIsSuspend() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>required bool is_suspend = 4;</code>
*/
public boolean getIsSuspend() {
return isSuspend_;
}
public static final int OVERRIDDEN_FIELD_NUMBER = 5;
private java.util.List<java.lang.Integer> overridden_;
/**
* <code>repeated int32 overridden = 5;</code>
*/
public java.util.List<java.lang.Integer>
public java.util.List<java.lang.Long>
getOverriddenList() {
return overridden_;
}
/**
* <code>repeated int32 overridden = 5;</code>
* <code>repeated int64 overridden = 2 [packed = true];</code>
*
* <pre>
* TODO: supposed to be deleted
* </pre>
*/
public int getOverriddenCount() {
return overridden_.size();
}
/**
* <code>repeated int32 overridden = 5;</code>
* <code>repeated int64 overridden = 2 [packed = true];</code>
*
* <pre>
* TODO: supposed to be deleted
* </pre>
*/
public int getOverridden(int index) {
public long getOverridden(int index) {
return overridden_.get(index);
}
public static final int IS_FAKE_OVERRIDE_FIELD_NUMBER = 8;
private boolean isFakeOverride_;
/**
* <code>required bool is_fake_override = 8;</code>
*
* <pre>
*optional UniqId corresponding_property = 7;
* </pre>
*/
public boolean hasIsFakeOverride() {
return ((bitField0_ & 0x00000010) == 0x00000010);
}
/**
* <code>required bool is_fake_override = 8;</code>
*
* <pre>
*optional UniqId corresponding_property = 7;
* </pre>
*/
public boolean getIsFakeOverride() {
return isFakeOverride_;
}
public static final int IS_OPERATOR_FIELD_NUMBER = 9;
private boolean isOperator_;
/**
* <code>required bool is_operator = 9;</code>
*/
public boolean hasIsOperator() {
return ((bitField0_ & 0x00000020) == 0x00000020);
}
/**
* <code>required bool is_operator = 9;</code>
*/
public boolean getIsOperator() {
return isOperator_;
}
private int overriddenMemoizedSerializedSize = -1;
private void initFields() {
base_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrFunctionBase.getDefaultInstance();
modality_ = org.jetbrains.kotlin.backend.common.serialization.proto.ModalityKind.FINAL_MODALITY;
isTailrec_ = false;
isSuspend_ = false;
overridden_ = java.util.Collections.emptyList();
isFakeOverride_ = false;
isOperator_ = false;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
@@ -295,26 +188,6 @@ public final class IrFunction extends
memoizedIsInitialized = 0;
return false;
}
if (!hasModality()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasIsTailrec()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasIsSuspend()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasIsFakeOverride()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasIsOperator()) {
memoizedIsInitialized = 0;
return false;
}
if (!getBase().isInitialized()) {
memoizedIsInitialized = 0;
return false;
@@ -329,23 +202,12 @@ public final class IrFunction extends
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeMessage(1, base_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeEnum(2, modality_.getNumber());
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeBool(3, isTailrec_);
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
output.writeBool(4, isSuspend_);
if (getOverriddenList().size() > 0) {
output.writeRawVarint32(18);
output.writeRawVarint32(overriddenMemoizedSerializedSize);
}
for (int i = 0; i < overridden_.size(); i++) {
output.writeInt32(5, overridden_.get(i));
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
output.writeBool(8, isFakeOverride_);
}
if (((bitField0_ & 0x00000020) == 0x00000020)) {
output.writeBool(9, isOperator_);
output.writeInt64NoTag(overridden_.get(i));
}
output.writeRawBytes(unknownFields);
}
@@ -360,34 +222,19 @@ public final class IrFunction extends
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(1, base_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeEnumSize(2, modality_.getNumber());
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeBoolSize(3, isTailrec_);
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeBoolSize(4, isSuspend_);
}
{
int dataSize = 0;
for (int i = 0; i < overridden_.size(); i++) {
dataSize += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32SizeNoTag(overridden_.get(i));
.computeInt64SizeNoTag(overridden_.get(i));
}
size += dataSize;
size += 1 * getOverriddenList().size();
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeBoolSize(8, isFakeOverride_);
}
if (((bitField0_ & 0x00000020) == 0x00000020)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeBoolSize(9, isOperator_);
if (!getOverriddenList().isEmpty()) {
size += 1;
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32SizeNoTag(dataSize);
}
overriddenMemoizedSerializedSize = dataSize;
}
size += unknownFields.size();
memoizedSerializedSize = size;
@@ -485,18 +332,8 @@ public final class IrFunction extends
super.clear();
base_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrFunctionBase.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000001);
modality_ = org.jetbrains.kotlin.backend.common.serialization.proto.ModalityKind.FINAL_MODALITY;
bitField0_ = (bitField0_ & ~0x00000002);
isTailrec_ = false;
bitField0_ = (bitField0_ & ~0x00000004);
isSuspend_ = false;
bitField0_ = (bitField0_ & ~0x00000008);
overridden_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000010);
isFakeOverride_ = false;
bitField0_ = (bitField0_ & ~0x00000020);
isOperator_ = false;
bitField0_ = (bitField0_ & ~0x00000040);
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
@@ -524,31 +361,11 @@ public final class IrFunction extends
to_bitField0_ |= 0x00000001;
}
result.base_ = base_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.modality_ = modality_;
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
to_bitField0_ |= 0x00000004;
}
result.isTailrec_ = isTailrec_;
if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
to_bitField0_ |= 0x00000008;
}
result.isSuspend_ = isSuspend_;
if (((bitField0_ & 0x00000010) == 0x00000010)) {
if (((bitField0_ & 0x00000002) == 0x00000002)) {
overridden_ = java.util.Collections.unmodifiableList(overridden_);
bitField0_ = (bitField0_ & ~0x00000010);
bitField0_ = (bitField0_ & ~0x00000002);
}
result.overridden_ = overridden_;
if (((from_bitField0_ & 0x00000020) == 0x00000020)) {
to_bitField0_ |= 0x00000010;
}
result.isFakeOverride_ = isFakeOverride_;
if (((from_bitField0_ & 0x00000040) == 0x00000040)) {
to_bitField0_ |= 0x00000020;
}
result.isOperator_ = isOperator_;
result.bitField0_ = to_bitField0_;
return result;
}
@@ -558,31 +375,16 @@ public final class IrFunction extends
if (other.hasBase()) {
mergeBase(other.getBase());
}
if (other.hasModality()) {
setModality(other.getModality());
}
if (other.hasIsTailrec()) {
setIsTailrec(other.getIsTailrec());
}
if (other.hasIsSuspend()) {
setIsSuspend(other.getIsSuspend());
}
if (!other.overridden_.isEmpty()) {
if (overridden_.isEmpty()) {
overridden_ = other.overridden_;
bitField0_ = (bitField0_ & ~0x00000010);
bitField0_ = (bitField0_ & ~0x00000002);
} else {
ensureOverriddenIsMutable();
overridden_.addAll(other.overridden_);
}
}
if (other.hasIsFakeOverride()) {
setIsFakeOverride(other.getIsFakeOverride());
}
if (other.hasIsOperator()) {
setIsOperator(other.getIsOperator());
}
setUnknownFields(
getUnknownFields().concat(other.unknownFields));
return this;
@@ -593,26 +395,6 @@ public final class IrFunction extends
return false;
}
if (!hasModality()) {
return false;
}
if (!hasIsTailrec()) {
return false;
}
if (!hasIsSuspend()) {
return false;
}
if (!hasIsFakeOverride()) {
return false;
}
if (!hasIsOperator()) {
return false;
}
if (!getBase().isInitialized()) {
return false;
@@ -699,155 +481,80 @@ public final class IrFunction extends
return this;
}
private org.jetbrains.kotlin.backend.common.serialization.proto.ModalityKind modality_ = org.jetbrains.kotlin.backend.common.serialization.proto.ModalityKind.FINAL_MODALITY;
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.ModalityKind modality = 2;</code>
*/
public boolean hasModality() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.ModalityKind modality = 2;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.ModalityKind getModality() {
return modality_;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.ModalityKind modality = 2;</code>
*/
public Builder setModality(org.jetbrains.kotlin.backend.common.serialization.proto.ModalityKind value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000002;
modality_ = value;
return this;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.ModalityKind modality = 2;</code>
*/
public Builder clearModality() {
bitField0_ = (bitField0_ & ~0x00000002);
modality_ = org.jetbrains.kotlin.backend.common.serialization.proto.ModalityKind.FINAL_MODALITY;
return this;
}
private boolean isTailrec_ ;
/**
* <code>required bool is_tailrec = 3;</code>
*/
public boolean hasIsTailrec() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required bool is_tailrec = 3;</code>
*/
public boolean getIsTailrec() {
return isTailrec_;
}
/**
* <code>required bool is_tailrec = 3;</code>
*/
public Builder setIsTailrec(boolean value) {
bitField0_ |= 0x00000004;
isTailrec_ = value;
return this;
}
/**
* <code>required bool is_tailrec = 3;</code>
*/
public Builder clearIsTailrec() {
bitField0_ = (bitField0_ & ~0x00000004);
isTailrec_ = false;
return this;
}
private boolean isSuspend_ ;
/**
* <code>required bool is_suspend = 4;</code>
*/
public boolean hasIsSuspend() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>required bool is_suspend = 4;</code>
*/
public boolean getIsSuspend() {
return isSuspend_;
}
/**
* <code>required bool is_suspend = 4;</code>
*/
public Builder setIsSuspend(boolean value) {
bitField0_ |= 0x00000008;
isSuspend_ = value;
return this;
}
/**
* <code>required bool is_suspend = 4;</code>
*/
public Builder clearIsSuspend() {
bitField0_ = (bitField0_ & ~0x00000008);
isSuspend_ = false;
return this;
}
private java.util.List<java.lang.Integer> overridden_ = java.util.Collections.emptyList();
private java.util.List<java.lang.Long> overridden_ = java.util.Collections.emptyList();
private void ensureOverriddenIsMutable() {
if (!((bitField0_ & 0x00000010) == 0x00000010)) {
overridden_ = new java.util.ArrayList<java.lang.Integer>(overridden_);
bitField0_ |= 0x00000010;
if (!((bitField0_ & 0x00000002) == 0x00000002)) {
overridden_ = new java.util.ArrayList<java.lang.Long>(overridden_);
bitField0_ |= 0x00000002;
}
}
/**
* <code>repeated int32 overridden = 5;</code>
* <code>repeated int64 overridden = 2 [packed = true];</code>
*
* <pre>
* TODO: supposed to be deleted
* </pre>
*/
public java.util.List<java.lang.Integer>
public java.util.List<java.lang.Long>
getOverriddenList() {
return java.util.Collections.unmodifiableList(overridden_);
}
/**
* <code>repeated int32 overridden = 5;</code>
* <code>repeated int64 overridden = 2 [packed = true];</code>
*
* <pre>
* TODO: supposed to be deleted
* </pre>
*/
public int getOverriddenCount() {
return overridden_.size();
}
/**
* <code>repeated int32 overridden = 5;</code>
* <code>repeated int64 overridden = 2 [packed = true];</code>
*
* <pre>
* TODO: supposed to be deleted
* </pre>
*/
public int getOverridden(int index) {
public long getOverridden(int index) {
return overridden_.get(index);
}
/**
* <code>repeated int32 overridden = 5;</code>
* <code>repeated int64 overridden = 2 [packed = true];</code>
*
* <pre>
* TODO: supposed to be deleted
* </pre>
*/
public Builder setOverridden(
int index, int value) {
int index, long value) {
ensureOverriddenIsMutable();
overridden_.set(index, value);
return this;
}
/**
* <code>repeated int32 overridden = 5;</code>
* <code>repeated int64 overridden = 2 [packed = true];</code>
*
* <pre>
* TODO: supposed to be deleted
* </pre>
*/
public Builder addOverridden(int value) {
public Builder addOverridden(long value) {
ensureOverriddenIsMutable();
overridden_.add(value);
return this;
}
/**
* <code>repeated int32 overridden = 5;</code>
* <code>repeated int64 overridden = 2 [packed = true];</code>
*
* <pre>
* TODO: supposed to be deleted
* </pre>
*/
public Builder addAllOverridden(
java.lang.Iterable<? extends java.lang.Integer> values) {
java.lang.Iterable<? extends java.lang.Long> values) {
ensureOverriddenIsMutable();
org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll(
values, overridden_);
@@ -855,91 +562,15 @@ public final class IrFunction extends
return this;
}
/**
* <code>repeated int32 overridden = 5;</code>
* <code>repeated int64 overridden = 2 [packed = true];</code>
*
* <pre>
* TODO: supposed to be deleted
* </pre>
*/
public Builder clearOverridden() {
overridden_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000010);
return this;
}
private boolean isFakeOverride_ ;
/**
* <code>required bool is_fake_override = 8;</code>
*
* <pre>
*optional UniqId corresponding_property = 7;
* </pre>
*/
public boolean hasIsFakeOverride() {
return ((bitField0_ & 0x00000020) == 0x00000020);
}
/**
* <code>required bool is_fake_override = 8;</code>
*
* <pre>
*optional UniqId corresponding_property = 7;
* </pre>
*/
public boolean getIsFakeOverride() {
return isFakeOverride_;
}
/**
* <code>required bool is_fake_override = 8;</code>
*
* <pre>
*optional UniqId corresponding_property = 7;
* </pre>
*/
public Builder setIsFakeOverride(boolean value) {
bitField0_ |= 0x00000020;
isFakeOverride_ = value;
return this;
}
/**
* <code>required bool is_fake_override = 8;</code>
*
* <pre>
*optional UniqId corresponding_property = 7;
* </pre>
*/
public Builder clearIsFakeOverride() {
bitField0_ = (bitField0_ & ~0x00000020);
isFakeOverride_ = false;
return this;
}
private boolean isOperator_ ;
/**
* <code>required bool is_operator = 9;</code>
*/
public boolean hasIsOperator() {
return ((bitField0_ & 0x00000040) == 0x00000040);
}
/**
* <code>required bool is_operator = 9;</code>
*/
public boolean getIsOperator() {
return isOperator_;
}
/**
* <code>required bool is_operator = 9;</code>
*/
public Builder setIsOperator(boolean value) {
bitField0_ |= 0x00000040;
isOperator_ = value;
return this;
}
/**
* <code>required bool is_operator = 9;</code>
*/
public Builder clearIsOperator() {
bitField0_ = (bitField0_ & ~0x00000040);
isOperator_ = false;
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
@@ -17,106 +17,66 @@ public interface IrFunctionBaseOrBuilder extends
org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationBase getBase();
/**
* <code>required int32 name = 2;</code>
* <code>required int64 name_type = 2;</code>
*/
boolean hasName();
boolean hasNameType();
/**
* <code>required int32 name = 2;</code>
* <code>required int64 name_type = 2;</code>
*/
int getName();
long getNameType();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Visibility visibility = 3;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter type_parameter = 3;</code>
*/
boolean hasVisibility();
java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter>
getTypeParameterList();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.Visibility visibility = 3;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter type_parameter = 3;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.Visibility getVisibility();
org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter getTypeParameter(int index);
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter type_parameter = 3;</code>
*/
int getTypeParameterCount();
/**
* <code>required bool is_inline = 4;</code>
*/
boolean hasIsInline();
/**
* <code>required bool is_inline = 4;</code>
*/
boolean getIsInline();
/**
* <code>required bool is_external = 5;</code>
*/
boolean hasIsExternal();
/**
* <code>required bool is_external = 5;</code>
*/
boolean getIsExternal();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameterContainer type_parameters = 6;</code>
*/
boolean hasTypeParameters();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameterContainer type_parameters = 6;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameterContainer getTypeParameters();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter dispatch_receiver = 7;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter dispatch_receiver = 4;</code>
*/
boolean hasDispatchReceiver();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter dispatch_receiver = 7;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter dispatch_receiver = 4;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter getDispatchReceiver();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter extension_receiver = 8;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter extension_receiver = 5;</code>
*/
boolean hasExtensionReceiver();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter extension_receiver = 8;</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter extension_receiver = 5;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter getExtensionReceiver();
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter value_parameter = 9;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter value_parameter = 6;</code>
*/
java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter>
getValueParameterList();
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter value_parameter = 9;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter value_parameter = 6;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter getValueParameter(int index);
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter value_parameter = 9;</code>
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter value_parameter = 6;</code>
*/
int getValueParameterCount();
/**
* <code>optional int32 body = 10;</code>
* <code>optional int32 body = 7;</code>
*/
boolean hasBody();
/**
* <code>optional int32 body = 10;</code>
* <code>optional int32 body = 7;</code>
*/
int getBody();
/**
* <code>required int32 return_type = 11;</code>
*/
boolean hasReturnType();
/**
* <code>required int32 return_type = 11;</code>
*/
int getReturnType();
/**
* <code>required bool is_expect = 12;</code>
*/
boolean hasIsExpect();
/**
* <code>required bool is_expect = 12;</code>
*/
boolean getIsExpect();
}
@@ -66,17 +66,9 @@ public final class IrFunctionExpression extends
bitField0_ |= 0x00000001;
break;
}
case 18: {
org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.Builder subBuilder = null;
if (((bitField0_ & 0x00000002) == 0x00000002)) {
subBuilder = origin_.toBuilder();
}
origin_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(origin_);
origin_ = subBuilder.buildPartial();
}
case 16: {
bitField0_ |= 0x00000002;
originName_ = input.readInt32();
break;
}
}
@@ -128,24 +120,24 @@ public final class IrFunctionExpression extends
return function_;
}
public static final int ORIGIN_FIELD_NUMBER = 2;
private org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin_;
public static final int ORIGIN_NAME_FIELD_NUMBER = 2;
private int originName_;
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 2;</code>
* <code>required int32 origin_name = 2;</code>
*/
public boolean hasOrigin() {
public boolean hasOriginName() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 2;</code>
* <code>required int32 origin_name = 2;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin getOrigin() {
return origin_;
public int getOriginName() {
return originName_;
}
private void initFields() {
function_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrFunction.getDefaultInstance();
origin_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.getDefaultInstance();
originName_ = 0;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
@@ -157,7 +149,7 @@ public final class IrFunctionExpression extends
memoizedIsInitialized = 0;
return false;
}
if (!hasOrigin()) {
if (!hasOriginName()) {
memoizedIsInitialized = 0;
return false;
}
@@ -165,10 +157,6 @@ public final class IrFunctionExpression extends
memoizedIsInitialized = 0;
return false;
}
if (!getOrigin().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1;
return true;
}
@@ -180,7 +168,7 @@ public final class IrFunctionExpression extends
output.writeMessage(1, function_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeMessage(2, origin_);
output.writeInt32(2, originName_);
}
output.writeRawBytes(unknownFields);
}
@@ -197,7 +185,7 @@ public final class IrFunctionExpression extends
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(2, origin_);
.computeInt32Size(2, originName_);
}
size += unknownFields.size();
memoizedSerializedSize = size;
@@ -295,7 +283,7 @@ public final class IrFunctionExpression extends
super.clear();
function_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrFunction.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000001);
origin_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.getDefaultInstance();
originName_ = 0;
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
@@ -327,7 +315,7 @@ public final class IrFunctionExpression extends
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.origin_ = origin_;
result.originName_ = originName_;
result.bitField0_ = to_bitField0_;
return result;
}
@@ -337,8 +325,8 @@ public final class IrFunctionExpression extends
if (other.hasFunction()) {
mergeFunction(other.getFunction());
}
if (other.hasOrigin()) {
mergeOrigin(other.getOrigin());
if (other.hasOriginName()) {
setOriginName(other.getOriginName());
}
setUnknownFields(
getUnknownFields().concat(other.unknownFields));
@@ -350,7 +338,7 @@ public final class IrFunctionExpression extends
return false;
}
if (!hasOrigin()) {
if (!hasOriginName()) {
return false;
}
@@ -358,10 +346,6 @@ public final class IrFunctionExpression extends
return false;
}
if (!getOrigin().isInitialized()) {
return false;
}
return true;
}
@@ -444,63 +428,35 @@ public final class IrFunctionExpression extends
return this;
}
private org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.getDefaultInstance();
private int originName_ ;
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 2;</code>
* <code>required int32 origin_name = 2;</code>
*/
public boolean hasOrigin() {
public boolean hasOriginName() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 2;</code>
* <code>required int32 origin_name = 2;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin getOrigin() {
return origin_;
public int getOriginName() {
return originName_;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 2;</code>
* <code>required int32 origin_name = 2;</code>
*/
public Builder setOrigin(org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin value) {
if (value == null) {
throw new NullPointerException();
}
origin_ = value;
public Builder setOriginName(int value) {
bitField0_ |= 0x00000002;
originName_ = value;
return this;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 2;</code>
* <code>required int32 origin_name = 2;</code>
*/
public Builder setOrigin(
org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.Builder builderForValue) {
origin_ = builderForValue.build();
bitField0_ |= 0x00000002;
return this;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 2;</code>
*/
public Builder mergeOrigin(org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin value) {
if (((bitField0_ & 0x00000002) == 0x00000002) &&
origin_ != org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.getDefaultInstance()) {
origin_ =
org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.newBuilder(origin_).mergeFrom(value).buildPartial();
} else {
origin_ = value;
}
bitField0_ |= 0x00000002;
return this;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 2;</code>
*/
public Builder clearOrigin() {
origin_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin.getDefaultInstance();
public Builder clearOriginName() {
bitField0_ = (bitField0_ & ~0x00000002);
originName_ = 0;
return this;
}
@@ -17,11 +17,11 @@ public interface IrFunctionExpressionOrBuilder extends
org.jetbrains.kotlin.backend.common.serialization.proto.IrFunction getFunction();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 2;</code>
* <code>required int32 origin_name = 2;</code>
*/
boolean hasOrigin();
boolean hasOriginName();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin origin = 2;</code>
* <code>required int32 origin_name = 2;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.IrStatementOrigin getOrigin();
int getOriginName();
}
@@ -17,68 +17,27 @@ public interface IrFunctionOrBuilder extends
org.jetbrains.kotlin.backend.common.serialization.proto.IrFunctionBase getBase();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.ModalityKind modality = 2;</code>
* <code>repeated int64 overridden = 2 [packed = true];</code>
*
* <pre>
* TODO: supposed to be deleted
* </pre>
*/
boolean hasModality();
java.util.List<java.lang.Long> getOverriddenList();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.ModalityKind modality = 2;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.ModalityKind getModality();
/**
* <code>required bool is_tailrec = 3;</code>
*/
boolean hasIsTailrec();
/**
* <code>required bool is_tailrec = 3;</code>
*/
boolean getIsTailrec();
/**
* <code>required bool is_suspend = 4;</code>
*/
boolean hasIsSuspend();
/**
* <code>required bool is_suspend = 4;</code>
*/
boolean getIsSuspend();
/**
* <code>repeated int32 overridden = 5;</code>
*/
java.util.List<java.lang.Integer> getOverriddenList();
/**
* <code>repeated int32 overridden = 5;</code>
* <code>repeated int64 overridden = 2 [packed = true];</code>
*
* <pre>
* TODO: supposed to be deleted
* </pre>
*/
int getOverriddenCount();
/**
* <code>repeated int32 overridden = 5;</code>
*/
int getOverridden(int index);
/**
* <code>required bool is_fake_override = 8;</code>
* <code>repeated int64 overridden = 2 [packed = true];</code>
*
* <pre>
*optional UniqId corresponding_property = 7;
* TODO: supposed to be deleted
* </pre>
*/
boolean hasIsFakeOverride();
/**
* <code>required bool is_fake_override = 8;</code>
*
* <pre>
*optional UniqId corresponding_property = 7;
* </pre>
*/
boolean getIsFakeOverride();
/**
* <code>required bool is_operator = 9;</code>
*/
boolean hasIsOperator();
/**
* <code>required bool is_operator = 9;</code>
*/
boolean getIsOperator();
long getOverridden(int index);
}

Some files were not shown because too many files have changed in this diff Show More