Minor: reformat code
This commit is contained in:
@@ -131,8 +131,7 @@ class BoxedToPrimitiveEquality private constructor(
|
|||||||
{ v.load(tmp, operandType) }
|
{ v.load(tmp, operandType) }
|
||||||
)
|
)
|
||||||
frameMap.leaveTemp(operandType)
|
frameMap.leaveTemp(operandType)
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
doJump(
|
doJump(
|
||||||
v, jumpLabel, jumpIfFalse,
|
v, jumpLabel, jumpIfFalse,
|
||||||
{ arg1.put(boxedType, v) },
|
{ arg1.put(boxedType, v) },
|
||||||
|
|||||||
@@ -59,8 +59,7 @@ open class BranchedValue(
|
|||||||
override fun loopJump(jumpLabel: Label, v: InstructionAdapter, jumpIfFalse: Boolean) {
|
override fun loopJump(jumpLabel: Label, v: InstructionAdapter, jumpIfFalse: Boolean) {
|
||||||
if (!jumpIfFalse) {
|
if (!jumpIfFalse) {
|
||||||
v.fakeAlwaysTrueIfeq(jumpLabel)
|
v.fakeAlwaysTrueIfeq(jumpLabel)
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
v.fakeAlwaysFalseIfeq(jumpLabel)
|
v.fakeAlwaysFalseIfeq(jumpLabel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -81,8 +80,7 @@ open class BranchedValue(
|
|||||||
override fun loopJump(jumpLabel: Label, v: InstructionAdapter, jumpIfFalse: Boolean) {
|
override fun loopJump(jumpLabel: Label, v: InstructionAdapter, jumpIfFalse: Boolean) {
|
||||||
if (jumpIfFalse) {
|
if (jumpIfFalse) {
|
||||||
v.fakeAlwaysTrueIfeq(jumpLabel)
|
v.fakeAlwaysTrueIfeq(jumpLabel)
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
v.fakeAlwaysFalseIfeq(jumpLabel)
|
v.fakeAlwaysFalseIfeq(jumpLabel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,8 +80,7 @@ fun generateIsCheck(
|
|||||||
|
|
||||||
mark(end)
|
mark(end)
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
TypeIntrinsics.instanceOf(v, kotlinType, asmType)
|
TypeIntrinsics.instanceOf(v, kotlinType, asmType)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -96,8 +95,7 @@ fun generateAsCast(
|
|||||||
if (!TypeUtils.isNullableType(kotlinType)) {
|
if (!TypeUtils.isNullableType(kotlinType)) {
|
||||||
generateNullCheckForNonSafeAs(v, kotlinType)
|
generateNullCheckForNonSafeAs(v, kotlinType)
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
with(v) {
|
with(v) {
|
||||||
dup()
|
dup()
|
||||||
TypeIntrinsics.instanceOf(v, kotlinType, asmType)
|
TypeIntrinsics.instanceOf(v, kotlinType, asmType)
|
||||||
@@ -120,15 +118,23 @@ private fun generateNullCheckForNonSafeAs(
|
|||||||
dup()
|
dup()
|
||||||
val nonnull = Label()
|
val nonnull = Label()
|
||||||
ifnonnull(nonnull)
|
ifnonnull(nonnull)
|
||||||
AsmUtil.genThrow(v, "kotlin/TypeCastException", "null cannot be cast to non-null type " + DescriptorRenderer.FQ_NAMES_IN_TYPES.renderType(type))
|
AsmUtil.genThrow(
|
||||||
|
v,
|
||||||
|
"kotlin/TypeCastException",
|
||||||
|
"null cannot be cast to non-null type " + DescriptorRenderer.FQ_NAMES_IN_TYPES.renderType(type)
|
||||||
|
)
|
||||||
mark(nonnull)
|
mark(nonnull)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun SpecialSignatureInfo.replaceValueParametersIn(sourceSignature: String?): String?
|
fun SpecialSignatureInfo.replaceValueParametersIn(sourceSignature: String?): String? =
|
||||||
= valueParametersSignature?.let { sourceSignature?.replace("^\\(.*\\)".toRegex(), "($it)") }
|
valueParametersSignature?.let { sourceSignature?.replace("^\\(.*\\)".toRegex(), "($it)") }
|
||||||
|
|
||||||
fun populateCompanionBackingFieldNamesToOuterContextIfNeeded(companion: KtObjectDeclaration, outerContext: FieldOwnerContext<*>, state: GenerationState) {
|
fun populateCompanionBackingFieldNamesToOuterContextIfNeeded(
|
||||||
|
companion: KtObjectDeclaration,
|
||||||
|
outerContext: FieldOwnerContext<*>,
|
||||||
|
state: GenerationState
|
||||||
|
) {
|
||||||
val descriptor = state.bindingContext.get(BindingContext.CLASS, companion)
|
val descriptor = state.bindingContext.get(BindingContext.CLASS, companion)
|
||||||
|
|
||||||
if (descriptor == null || ErrorUtils.isError(descriptor)) {
|
if (descriptor == null || ErrorUtils.isError(descriptor)) {
|
||||||
@@ -150,7 +156,11 @@ fun populateCompanionBackingFieldNamesToOuterContextIfNeeded(companion: KtObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: inline and remove then ScriptCodegen is converted to Kotlin
|
// TODO: inline and remove then ScriptCodegen is converted to Kotlin
|
||||||
fun mapSupertypesNames(typeMapper: KotlinTypeMapper, supertypes: List<ClassDescriptor>, signatureVisitor: JvmSignatureWriter?): Array<String> =
|
fun mapSupertypesNames(
|
||||||
|
typeMapper: KotlinTypeMapper,
|
||||||
|
supertypes: List<ClassDescriptor>,
|
||||||
|
signatureVisitor: JvmSignatureWriter?
|
||||||
|
): Array<String> =
|
||||||
supertypes.map { typeMapper.mapSupertype(it.defaultType, signatureVisitor).internalName }.toTypedArray()
|
supertypes.map { typeMapper.mapSupertype(it.defaultType, signatureVisitor).internalName }.toTypedArray()
|
||||||
|
|
||||||
|
|
||||||
@@ -183,8 +193,7 @@ fun sortTopLevelClassesAndPrepareContextForSealedClasses(
|
|||||||
val descriptor = state.bindingContext.get(BindingContext.CLASS, classOrObject)
|
val descriptor = state.bindingContext.get(BindingContext.CLASS, classOrObject)
|
||||||
if (descriptor == null) {
|
if (descriptor == null) {
|
||||||
result.add(classOrObject)
|
result.add(classOrObject)
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
prepareContextIfNeeded(descriptor)
|
prepareContextIfNeeded(descriptor)
|
||||||
descriptorToPsi[descriptor] = classOrObject
|
descriptorToPsi[descriptor] = classOrObject
|
||||||
}
|
}
|
||||||
@@ -224,7 +233,7 @@ fun ClassBuilder.generateMethod(
|
|||||||
|
|
||||||
|
|
||||||
fun reportTarget6InheritanceErrorIfNeeded(
|
fun reportTarget6InheritanceErrorIfNeeded(
|
||||||
classDescriptor: ClassDescriptor, classElement: PsiElement, restrictedInheritance: List<FunctionDescriptor>, state:GenerationState
|
classDescriptor: ClassDescriptor, classElement: PsiElement, restrictedInheritance: List<FunctionDescriptor>, state: GenerationState
|
||||||
) {
|
) {
|
||||||
if (!restrictedInheritance.isEmpty()) {
|
if (!restrictedInheritance.isEmpty()) {
|
||||||
val groupBy = restrictedInheritance.groupBy { descriptor -> descriptor.containingDeclaration as ClassDescriptor }
|
val groupBy = restrictedInheritance.groupBy { descriptor -> descriptor.containingDeclaration as ClassDescriptor }
|
||||||
|
|||||||
Reference in New Issue
Block a user