Minor. Reformat

This commit is contained in:
Mikhael Bogdanov
2018-05-07 14:32:37 +02:00
parent 9277d6a160
commit 9fad3f25f3
6 changed files with 222 additions and 194 deletions
@@ -17,7 +17,7 @@ import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.util.OperatorNameConventions
// This is what Context collects about IR.
abstract class Ir<out T: CommonBackendContext>(val context: T, val irModule: IrModuleFragment) {
abstract class Ir<out T : CommonBackendContext>(val context: T, val irModule: IrModuleFragment) {
abstract val symbols: Symbols<T>
@@ -26,13 +26,13 @@ abstract class Ir<out T: CommonBackendContext>(val context: T, val irModule: IrM
open fun shouldGenerateHandlerParameterForDefaultBodyFun() = false
}
abstract class Symbols<out T: CommonBackendContext>(val context: T, private val symbolTable: SymbolTable) {
abstract class Symbols<out T : CommonBackendContext>(val context: T, private val symbolTable: SymbolTable) {
protected val builtIns
get() = context.builtIns
protected fun builtInsPackage(vararg packageNameSegments: String) =
context.builtIns.builtInsModule.getPackage(FqName.fromSegments(listOf(*packageNameSegments))).memberScope
context.builtIns.builtInsModule.getPackage(FqName.fromSegments(listOf(*packageNameSegments))).memberScope
// This hack allows to disable related symbol instantiation in descendants
@@ -56,22 +56,23 @@ abstract class Symbols<out T: CommonBackendContext>(val context: T, private val
abstract val stringBuilder: IrClassSymbol
val iterator = symbolTable.referenceClass(
builtInsPackage("kotlin", "collections").getContributedClassifier(
Name.identifier("Iterator"), NoLookupLocation.FROM_BACKEND
) as ClassDescriptor)
builtInsPackage("kotlin", "collections").getContributedClassifier(
Name.identifier("Iterator"), NoLookupLocation.FROM_BACKEND
) as ClassDescriptor
)
val asserts = builtInsPackage("kotlin")
.getContributedFunctions(Name.identifier("assert"), NoLookupLocation.FROM_BACKEND)
.map { symbolTable.referenceFunction(it) }
.getContributedFunctions(Name.identifier("assert"), NoLookupLocation.FROM_BACKEND)
.map { symbolTable.referenceFunction(it) }
private fun progression(name: String) = symbolTable.referenceClass(
builtInsPackage("kotlin", "ranges").getContributedClassifier(
Name.identifier(name), NoLookupLocation.FROM_BACKEND
) as ClassDescriptor
builtInsPackage("kotlin", "ranges").getContributedClassifier(
Name.identifier(name), NoLookupLocation.FROM_BACKEND
) as ClassDescriptor
)
val charProgression = progression("CharProgression")
val intProgression = progression("IntProgression")
val intProgression = progression("IntProgression")
val longProgression = progression("LongProgression")
val progressionClasses = listOf(charProgression, intProgression, longProgression)
val progressionClassesTypes = progressionClasses.map { it.descriptor.defaultType }.toSet()
@@ -97,15 +98,15 @@ abstract class Symbols<out T: CommonBackendContext>(val context: T, private val
val integerClassesTypes = integerClasses.map { it.descriptor.defaultType }
val arrayOf = symbolTable.referenceSimpleFunction(
builtInsPackage("kotlin").getContributedFunctions(
Name.identifier("arrayOf"), NoLookupLocation.FROM_BACKEND
).single()
builtInsPackage("kotlin").getContributedFunctions(
Name.identifier("arrayOf"), NoLookupLocation.FROM_BACKEND
).single()
)
val array = symbolTable.referenceClass(builtIns.array)
private fun primitiveArrayClass(type: PrimitiveType) =
symbolTable.referenceClass(builtIns.getPrimitiveArrayClassDescriptor(type))
symbolTable.referenceClass(builtIns.getPrimitiveArrayClassDescriptor(type))
val byteArray = primitiveArrayClass(PrimitiveType.BYTE)
val charArray = primitiveArrayClass(PrimitiveType.CHAR)
@@ -120,24 +121,26 @@ abstract class Symbols<out T: CommonBackendContext>(val context: T, private val
protected fun arrayExtensionFun(type: KotlinType, name: String): IrSimpleFunctionSymbol {
val descriptor = builtInsPackage("kotlin")
.getContributedFunctions(Name.identifier(name), NoLookupLocation.FROM_BACKEND)
.singleOrNull { it.valueParameters.isEmpty()
&& (it.extensionReceiverParameter?.type?.constructor?.declarationDescriptor as? ClassDescriptor)?.defaultType == type }
.getContributedFunctions(Name.identifier(name), NoLookupLocation.FROM_BACKEND)
.singleOrNull {
it.valueParameters.isEmpty()
&& (it.extensionReceiverParameter?.type?.constructor?.declarationDescriptor as? ClassDescriptor)?.defaultType == type
}
?: throw Error(type.toString())
return symbolTable.referenceSimpleFunction(descriptor)
}
protected val arrayTypes = arrayOf(
builtIns.getPrimitiveArrayKotlinType(PrimitiveType.BYTE),
builtIns.getPrimitiveArrayKotlinType(PrimitiveType.CHAR),
builtIns.getPrimitiveArrayKotlinType(PrimitiveType.SHORT),
builtIns.getPrimitiveArrayKotlinType(PrimitiveType.INT),
builtIns.getPrimitiveArrayKotlinType(PrimitiveType.LONG),
builtIns.getPrimitiveArrayKotlinType(PrimitiveType.FLOAT),
builtIns.getPrimitiveArrayKotlinType(PrimitiveType.DOUBLE),
builtIns.getPrimitiveArrayKotlinType(PrimitiveType.BOOLEAN),
builtIns.array.defaultType
builtIns.getPrimitiveArrayKotlinType(PrimitiveType.BYTE),
builtIns.getPrimitiveArrayKotlinType(PrimitiveType.CHAR),
builtIns.getPrimitiveArrayKotlinType(PrimitiveType.SHORT),
builtIns.getPrimitiveArrayKotlinType(PrimitiveType.INT),
builtIns.getPrimitiveArrayKotlinType(PrimitiveType.LONG),
builtIns.getPrimitiveArrayKotlinType(PrimitiveType.FLOAT),
builtIns.getPrimitiveArrayKotlinType(PrimitiveType.DOUBLE),
builtIns.getPrimitiveArrayKotlinType(PrimitiveType.BOOLEAN),
builtIns.array.defaultType
)
// val arrayContentToString = arrayTypes.associateBy({ it }, { arrayExtensionFun(it, "contentToString") })
// val arrayContentHashCode = arrayTypes.associateBy({ it }, { arrayExtensionFun(it, "contentHashCode") })
@@ -145,17 +148,17 @@ abstract class Symbols<out T: CommonBackendContext>(val context: T, private val
abstract val copyRangeTo: Map<ClassDescriptor, IrSimpleFunctionSymbol>
val intAnd = symbolTable.referenceSimpleFunction(
builtIns.intType.memberScope
.getContributedFunctions(OperatorNameConventions.AND, NoLookupLocation.FROM_BACKEND)
.single()
builtIns.intType.memberScope
.getContributedFunctions(OperatorNameConventions.AND, NoLookupLocation.FROM_BACKEND)
.single()
)
val intPlusInt = symbolTable.referenceSimpleFunction(
builtIns.intType.memberScope
.getContributedFunctions(OperatorNameConventions.PLUS, NoLookupLocation.FROM_BACKEND)
.single {
it.valueParameters.single().type == builtIns.intType
}
builtIns.intType.memberScope
.getContributedFunctions(OperatorNameConventions.PLUS, NoLookupLocation.FROM_BACKEND)
.single {
it.valueParameters.single().type == builtIns.intType
}
)
// val valuesForEnum = symbolTable.referenceSimpleFunction(
@@ -184,10 +187,10 @@ abstract class Symbols<out T: CommonBackendContext>(val context: T, private val
fun getFunction(name: Name, receiverType: KotlinType, vararg argTypes: KotlinType) =
symbolTable.referenceFunction(receiverType.memberScope.getContributedFunctions(name, NoLookupLocation.FROM_BACKEND)
.single {
var i = 0
it.valueParameters.size == argTypes.size && it.valueParameters.all { type -> type == argTypes[i++] }
}
.single {
var i = 0
it.valueParameters.size == argTypes.size && it.valueParameters.all { type -> type == argTypes[i++] }
}
)
private val binaryOperatorCache = mutableMapOf<Triple<Name, KotlinType, KotlinType>, IrFunctionSymbol>()
@@ -196,7 +199,7 @@ abstract class Symbols<out T: CommonBackendContext>(val context: T, private val
var result = binaryOperatorCache[key]
if (result == null) {
result = symbolTable.referenceFunction(lhsType.memberScope.getContributedFunctions(name, NoLookupLocation.FROM_BACKEND)
.single { it.valueParameters.size == 1 && it.valueParameters[0].type == rhsType }
.single { it.valueParameters.size == 1 && it.valueParameters[0].type == rhsType }
)
binaryOperatorCache[key] = result
}
@@ -209,7 +212,7 @@ abstract class Symbols<out T: CommonBackendContext>(val context: T, private val
var result = unaryOperatorCache[key]
if (result == null) {
result = symbolTable.referenceFunction(receiverType.memberScope.getContributedFunctions(name, NoLookupLocation.FROM_BACKEND)
.single { it.valueParameters.isEmpty() }
.single { it.valueParameters.isEmpty() }
)
unaryOperatorCache[key] = result
}
@@ -45,14 +45,14 @@ import org.jetbrains.kotlin.utils.Printer
class IrLoweringContext(backendContext: BackendContext) : IrGeneratorContext(backendContext.irBuiltIns)
class DeclarationIrBuilder(
backendContext: BackendContext,
symbol: IrSymbol,
startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET
backendContext: BackendContext,
symbol: IrSymbol,
startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET
) : IrBuilderWithScope(
IrLoweringContext(backendContext),
Scope(symbol),
startOffset,
endOffset
IrLoweringContext(backendContext),
Scope(symbol),
startOffset,
endOffset
)
abstract class AbstractVariableRemapper : IrElementTransformerVoid() {
@@ -69,10 +69,12 @@ class VariableRemapper(val mapping: Map<ValueDescriptor, IrValueParameter>) : Ab
mapping[value]
}
fun BackendContext.createIrBuilder(symbol: IrSymbol,
startOffset: Int = UNDEFINED_OFFSET,
endOffset: Int = UNDEFINED_OFFSET) =
DeclarationIrBuilder(this, symbol, startOffset, endOffset)
fun BackendContext.createIrBuilder(
symbol: IrSymbol,
startOffset: Int = UNDEFINED_OFFSET,
endOffset: Int = UNDEFINED_OFFSET
) =
DeclarationIrBuilder(this, symbol, startOffset, endOffset)
fun <T : IrBuilder> T.at(element: IrElement) = this.at(element.startOffset, element.endOffset)
@@ -80,41 +82,45 @@ fun <T : IrBuilder> T.at(element: IrElement) = this.at(element.startOffset, elem
/**
* Builds [IrBlock] to be used instead of given expression.
*/
inline fun IrGeneratorWithScope.irBlock(expression: IrExpression, origin: IrStatementOrigin? = null,
resultType: KotlinType? = expression.type,
body: IrBlockBuilder.() -> Unit) =
this.irBlock(expression.startOffset, expression.endOffset, origin, resultType, body)
inline fun IrGeneratorWithScope.irBlock(
expression: IrExpression, origin: IrStatementOrigin? = null,
resultType: KotlinType? = expression.type,
body: IrBlockBuilder.() -> Unit
) =
this.irBlock(expression.startOffset, expression.endOffset, origin, resultType, body)
inline fun IrGeneratorWithScope.irBlockBody(irElement: IrElement, body: IrBlockBodyBuilder.() -> Unit) =
this.irBlockBody(irElement.startOffset, irElement.endOffset, body)
this.irBlockBody(irElement.startOffset, irElement.endOffset, body)
fun IrBuilderWithScope.irIfThen(condition: IrExpression, thenPart: IrExpression) =
IrIfThenElseImpl(startOffset, endOffset, context.builtIns.unitType, condition, thenPart, null)
IrIfThenElseImpl(startOffset, endOffset, context.builtIns.unitType, condition, thenPart, null)
fun IrBuilderWithScope.irNot(arg: IrExpression) =
primitiveOp1(startOffset, endOffset, context.irBuiltIns.booleanNotSymbol, IrStatementOrigin.EXCL, arg)
primitiveOp1(startOffset, endOffset, context.irBuiltIns.booleanNotSymbol, IrStatementOrigin.EXCL, arg)
fun IrBuilderWithScope.irThrow(arg: IrExpression) =
IrThrowImpl(startOffset, endOffset, context.builtIns.nothingType, arg)
IrThrowImpl(startOffset, endOffset, context.builtIns.nothingType, arg)
fun IrBuilderWithScope.irCatch(catchParameter: IrVariable) =
IrCatchImpl(
startOffset, endOffset,
catchParameter
)
IrCatchImpl(
startOffset, endOffset,
catchParameter
)
fun IrBuilderWithScope.irCast(arg: IrExpression, type: KotlinType, typeOperand: KotlinType) =
IrTypeOperatorCallImpl(startOffset, endOffset, type, IrTypeOperator.CAST, typeOperand, arg)
IrTypeOperatorCallImpl(startOffset, endOffset, type, IrTypeOperator.CAST, typeOperand, arg)
fun IrBuilderWithScope.irImplicitCoercionToUnit(arg: IrExpression) =
IrTypeOperatorCallImpl(startOffset, endOffset, context.builtIns.unitType,
IrTypeOperator.IMPLICIT_COERCION_TO_UNIT, context.builtIns.unitType, arg)
IrTypeOperatorCallImpl(
startOffset, endOffset, context.builtIns.unitType,
IrTypeOperator.IMPLICIT_COERCION_TO_UNIT, context.builtIns.unitType, arg
)
fun IrBuilderWithScope.irGetField(receiver: IrExpression, symbol: IrFieldSymbol) =
IrGetFieldImpl(startOffset, endOffset, symbol, receiver)
IrGetFieldImpl(startOffset, endOffset, symbol, receiver)
fun IrBuilderWithScope.irSetField(receiver: IrExpression, symbol: IrFieldSymbol, value: IrExpression) =
IrSetFieldImpl(startOffset, endOffset, symbol, receiver, value)
IrSetFieldImpl(startOffset, endOffset, symbol, receiver, value)
open class IrBuildingTransformer(private val context: BackendContext) : IrElementTransformerVoid() {
private var currentBuilder: IrBuilderWithScope? = null
@@ -157,24 +163,24 @@ fun computeOverrides(current: ClassDescriptor, functionsFromCurrent: List<Callab
val result = mutableListOf<DeclarationDescriptor>()
val allSuperDescriptors = current.typeConstructor.supertypes
.flatMap { it.memberScope.getContributedDescriptors() }
.filterIsInstance<CallableMemberDescriptor>()
.flatMap { it.memberScope.getContributedDescriptors() }
.filterIsInstance<CallableMemberDescriptor>()
for ((name, group) in allSuperDescriptors.groupBy { it.name }) {
OverridingUtil.generateOverridesInFunctionGroup(
name,
/* membersFromSupertypes = */ group,
/* membersFromCurrent = */ functionsFromCurrent.filter { it.name == name },
current,
object : NonReportingOverrideStrategy() {
override fun addFakeOverride(fakeOverride: CallableMemberDescriptor) {
result.add(fakeOverride)
}
override fun conflict(fromSuper: CallableMemberDescriptor, fromCurrent: CallableMemberDescriptor) {
error("Conflict in scope of $current: $fromSuper vs $fromCurrent")
}
name,
/* membersFromSupertypes = */ group,
/* membersFromCurrent = */ functionsFromCurrent.filter { it.name == name },
current,
object : NonReportingOverrideStrategy() {
override fun addFakeOverride(fakeOverride: CallableMemberDescriptor) {
result.add(fakeOverride)
}
override fun conflict(fromSuper: CallableMemberDescriptor, fromCurrent: CallableMemberDescriptor) {
error("Conflict in scope of $current: $fromSuper vs $fromCurrent")
}
}
)
}
@@ -184,20 +190,22 @@ fun computeOverrides(current: ClassDescriptor, functionsFromCurrent: List<Callab
class SimpleMemberScope(val members: List<DeclarationDescriptor>) : MemberScopeImpl() {
override fun getContributedClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? =
members.filterIsInstance<ClassifierDescriptor>()
.atMostOne { it.name == name }
members.filterIsInstance<ClassifierDescriptor>()
.atMostOne { it.name == name }
override fun getContributedVariables(name: Name, location: LookupLocation): Collection<PropertyDescriptor> =
members.filterIsInstance<PropertyDescriptor>()
.filter { it.name == name }
members.filterIsInstance<PropertyDescriptor>()
.filter { it.name == name }
override fun getContributedFunctions(name: Name, location: LookupLocation): Collection<SimpleFunctionDescriptor> =
members.filterIsInstance<SimpleFunctionDescriptor>()
.filter { it.name == name }
members.filterIsInstance<SimpleFunctionDescriptor>()
.filter { it.name == name }
override fun getContributedDescriptors(kindFilter: DescriptorKindFilter,
nameFilter: (Name) -> Boolean): Collection<DeclarationDescriptor> =
members.filter { kindFilter.accepts(it) && nameFilter(it.name) }
override fun getContributedDescriptors(
kindFilter: DescriptorKindFilter,
nameFilter: (Name) -> Boolean
): Collection<DeclarationDescriptor> =
members.filter { kindFilter.accepts(it) && nameFilter(it.name) }
override fun printScopeStructure(p: Printer) = TODO("not implemented")
@@ -222,29 +230,30 @@ fun IrConstructor.callsSuper(): Boolean {
if (expression.descriptor.constructedClass == superClass)
callsSuper = true
else if (expression.descriptor.constructedClass != constructedClass)
throw AssertionError("Expected either call to another constructor of the class being constructed or" +
" call to super class constructor. But was: ${expression.descriptor.constructedClass}")
throw AssertionError(
"Expected either call to another constructor of the class being constructed or" +
" call to super class constructor. But was: ${expression.descriptor.constructedClass}"
)
}
})
assert(numberOfCalls == 1, { "Expected exactly one delegating constructor call but none encountered: $descriptor" })
return callsSuper
}
fun ParameterDescriptor.copyAsValueParameter(newOwner: CallableDescriptor, index: Int)
= when (this) {
fun ParameterDescriptor.copyAsValueParameter(newOwner: CallableDescriptor, index: Int) = when (this) {
is ValueParameterDescriptor -> this.copy(newOwner, name, index)
is ReceiverParameterDescriptor -> ValueParameterDescriptorImpl(
containingDeclaration = newOwner,
original = null,
index = index,
annotations = annotations,
name = name,
outType = type,
declaresDefaultValue = false,
isCrossinline = false,
isNoinline = false,
varargElementType = null,
source = source
containingDeclaration = newOwner,
original = null,
index = index,
annotations = annotations,
name = name,
outType = type,
declaresDefaultValue = false,
isCrossinline = false,
isNoinline = false,
varargElementType = null,
source = source
)
else -> throw Error("Unexpected parameter descriptor: $this")
}
@@ -25,13 +25,14 @@ import org.jetbrains.kotlin.ir.builders.IrBuilderWithScope
import org.jetbrains.kotlin.ir.builders.irCall
import org.jetbrains.kotlin.ir.builders.irGet
import org.jetbrains.kotlin.ir.builders.irTemporary
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
import org.jetbrains.kotlin.ir.declarations.IrFile
import org.jetbrains.kotlin.ir.declarations.IrSymbolDeclaration
import org.jetbrains.kotlin.ir.expressions.IrExpression
import org.jetbrains.kotlin.ir.expressions.IrStringConcatenation
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
import org.jetbrains.kotlin.ir.util.constructors
import org.jetbrains.kotlin.ir.util.functions
import org.jetbrains.kotlin.ir.util.type
import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
import org.jetbrains.kotlin.name.Name
@@ -54,7 +55,7 @@ private class StringConcatenationTransformer(val lower: StringConcatenationLower
private val builtIns = context.builtIns
private val typesWithSpecialAppendFunction =
PrimitiveType.values().map { builtIns.getPrimitiveKotlinType(it) } + builtIns.stringType
PrimitiveType.values().map { builtIns.getPrimitiveKotlinType(it) } + builtIns.stringType
private val nameToString = Name.identifier("toString")
private val nameAppend = Name.identifier("append")
@@ -77,16 +78,16 @@ private class StringConcatenationTransformer(val lower: StringConcatenationLower
private val appendFunctions: Map<KotlinType, IrFunctionSymbol?> =
typesWithSpecialAppendFunction.map { type ->
type to stringBuilder.functions.toList().atMostOne {
it.descriptor.name == nameAppend &&
it.owner.valueParameters.size == 1 &&
it.owner.valueParameters.single().type == type
}
}.toMap()
typesWithSpecialAppendFunction.map { type ->
type to stringBuilder.functions.toList().atMostOne {
it.descriptor.name == nameAppend &&
it.owner.valueParameters.size == 1 &&
it.owner.valueParameters.single().type == type
}
}.toMap()
private fun typeToAppendFunction(type : KotlinType) : IrFunctionSymbol {
return appendFunctions[type]?:defaultAppendFunction
private fun typeToAppendFunction(type: KotlinType): IrFunctionSymbol {
return appendFunctions[type] ?: defaultAppendFunction
}
override fun visitStringConcatenation(expression: IrStringConcatenation): IrExpression {
@@ -116,7 +117,7 @@ private class StringConcatenationTransformer(val lower: StringConcatenationLower
with(declaration) {
buildersStack.add(
context.createIrBuilder(declaration.symbol, startOffset, endOffset)
context.createIrBuilder(declaration.symbol, startOffset, endOffset)
)
transformChildrenVoid(this@StringConcatenationTransformer)
buildersStack.removeAt(buildersStack.lastIndex)
@@ -27,10 +27,18 @@ interface DefaultImplsClassDescriptor : ClassDescriptor {
}
class DefaultImplsClassDescriptorImpl(
name: Name,
override val correspondingInterface: ClassDescriptor,
sourceElement: SourceElement
) : DefaultImplsClassDescriptor, KnownClassDescriptor(name, correspondingInterface, sourceElement, ClassKind.CLASS, Modality.FINAL, Visibilities.PUBLIC, Annotations.EMPTY) {
name: Name,
override val correspondingInterface: ClassDescriptor,
sourceElement: SourceElement
) : DefaultImplsClassDescriptor, KnownClassDescriptor(
name,
correspondingInterface,
sourceElement,
ClassKind.CLASS,
Modality.FINAL,
Visibilities.PUBLIC,
Annotations.EMPTY
) {
init {
initialize(emptyList(), listOf(correspondingInterface.module.builtIns.anyType))
}
@@ -24,15 +24,15 @@ import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.types.KotlinType
class FileClassDescriptorImpl(
name: Name,
containingDeclaration: PackageFragmentDescriptor,
supertypes: List<KotlinType>,
sourceElement: SourceElement,
annotations: Annotations
name: Name,
containingDeclaration: PackageFragmentDescriptor,
supertypes: List<KotlinType>,
sourceElement: SourceElement,
annotations: Annotations
) : FileClassDescriptor, KnownClassDescriptor(
name, containingDeclaration, sourceElement,
ClassKind.CLASS, Modality.FINAL, Visibilities.PUBLIC,
annotations
name, containingDeclaration, sourceElement,
ClassKind.CLASS, Modality.FINAL, Visibilities.PUBLIC,
annotations
) {
init {
initialize(emptyList(), supertypes)
@@ -28,85 +28,92 @@ interface JvmDescriptorWithExtraFlags {
}
class JvmPropertyDescriptorImpl private constructor(
containingDeclaration: DeclarationDescriptor,
original: PropertyDescriptor?,
annotations: Annotations,
modality: Modality,
visibility: Visibility,
override val extraFlags: Int,
isVar: Boolean,
name: Name,
kind: CallableMemberDescriptor.Kind,
source: SourceElement,
isLateInit: Boolean,
isConst: Boolean,
isExpect: Boolean,
isActual: Boolean
containingDeclaration: DeclarationDescriptor,
original: PropertyDescriptor?,
annotations: Annotations,
modality: Modality,
visibility: Visibility,
override val extraFlags: Int,
isVar: Boolean,
name: Name,
kind: CallableMemberDescriptor.Kind,
source: SourceElement,
isLateInit: Boolean,
isConst: Boolean,
isExpect: Boolean,
isActual: Boolean
) : JvmDescriptorWithExtraFlags, PropertyDescriptorImpl(
containingDeclaration, original, annotations, modality, visibility, isVar,
name, kind, source, isLateInit, isConst, isExpect, isActual, /* isExternal = */ false, false
containingDeclaration, original, annotations, modality, visibility, isVar,
name, kind, source, isLateInit, isConst, isExpect, isActual, /* isExternal = */ false, false
) {
override fun createSubstitutedCopy(
newOwner: DeclarationDescriptor,
newModality: Modality,
newVisibility: Visibility,
original: PropertyDescriptor?,
kind: CallableMemberDescriptor.Kind,
newName: Name
newOwner: DeclarationDescriptor,
newModality: Modality,
newVisibility: Visibility,
original: PropertyDescriptor?,
kind: CallableMemberDescriptor.Kind,
newName: Name
): PropertyDescriptorImpl =
JvmPropertyDescriptorImpl(
newOwner, original, annotations, newModality, newVisibility, extraFlags, isVar, newName, kind,
SourceElement.NO_SOURCE, isLateInit, isConst, isExpect, isActual
)
JvmPropertyDescriptorImpl(
newOwner, original, annotations, newModality, newVisibility, extraFlags, isVar, newName, kind,
SourceElement.NO_SOURCE, isLateInit, isConst, isExpect, isActual
)
companion object {
fun createStaticVal(
name: Name,
type: KotlinType,
containingDeclaration: DeclarationDescriptor,
annotations: Annotations,
modality: Modality,
visibility: Visibility,
extraFlags: Int,
source: SourceElement
name: Name,
type: KotlinType,
containingDeclaration: DeclarationDescriptor,
annotations: Annotations,
modality: Modality,
visibility: Visibility,
extraFlags: Int,
source: SourceElement
): PropertyDescriptorImpl =
JvmPropertyDescriptorImpl(
containingDeclaration, null, annotations, modality, visibility, extraFlags, false, name,
CallableMemberDescriptor.Kind.SYNTHESIZED, source, false, false, false, false
).initialize(type)
JvmPropertyDescriptorImpl(
containingDeclaration, null, annotations, modality, visibility, extraFlags, false, name,
CallableMemberDescriptor.Kind.SYNTHESIZED, source, false, false, false, false
).initialize(type)
fun createFinalField(
name: Name,
type: KotlinType,
classDescriptor: ClassDescriptor,
annotations: Annotations,
visibility: Visibility,
extraFlags: Int,
source: SourceElement
name: Name,
type: KotlinType,
classDescriptor: ClassDescriptor,
annotations: Annotations,
visibility: Visibility,
extraFlags: Int,
source: SourceElement
): PropertyDescriptorImpl =
JvmPropertyDescriptorImpl(
classDescriptor, null, annotations, Modality.FINAL, visibility, extraFlags, false, name,
CallableMemberDescriptor.Kind.SYNTHESIZED, source, false, false, false, false
).initialize(type, dispatchReceiverParameter = classDescriptor.thisAsReceiverParameter)
JvmPropertyDescriptorImpl(
classDescriptor, null, annotations, Modality.FINAL, visibility, extraFlags, false, name,
CallableMemberDescriptor.Kind.SYNTHESIZED, source, false, false, false, false
).initialize(type, dispatchReceiverParameter = classDescriptor.thisAsReceiverParameter)
}
}
class JvmFunctionDescriptorImpl(
containingDeclaration: DeclarationDescriptor,
original: FunctionDescriptor?,
annotations: Annotations,
name: Name,
kind: CallableMemberDescriptor.Kind,
source: SourceElement,
override val extraFlags: Int
containingDeclaration: DeclarationDescriptor,
original: FunctionDescriptor?,
annotations: Annotations,
name: Name,
kind: CallableMemberDescriptor.Kind,
source: SourceElement,
override val extraFlags: Int
) : JvmDescriptorWithExtraFlags, FunctionDescriptorImpl(
containingDeclaration, original, annotations,
name, kind, source
containingDeclaration, original, annotations,
name, kind, source
) {
override fun createSubstitutedCopy(newOwner: DeclarationDescriptor, original: FunctionDescriptor?, kind: CallableMemberDescriptor.Kind, newName: Name?, annotations: Annotations, source: SourceElement): FunctionDescriptorImpl {
override fun createSubstitutedCopy(
newOwner: DeclarationDescriptor,
original: FunctionDescriptor?,
kind: CallableMemberDescriptor.Kind,
newName: Name?,
annotations: Annotations,
source: SourceElement
): FunctionDescriptorImpl {
return JvmFunctionDescriptorImpl(
newOwner, original, annotations, name, kind,
SourceElement.NO_SOURCE, extraFlags
newOwner, original, annotations, name, kind,
SourceElement.NO_SOURCE, extraFlags
)
}
}