Minor. Reformat

This commit is contained in:
Mikhael Bogdanov
2018-08-25 13:24:00 +02:00
parent 7843d4e0d4
commit 7e7b556018
@@ -26,7 +26,12 @@ abstract class AbstractWriteSignatureTest : CodegenTestCase() {
} }
} }
private class SignatureExpectation(val header: String, val name: String, val expectedJvmSignature: String?, expectedGenericSignature: String) { private class SignatureExpectation(
val header: String,
val name: String,
val expectedJvmSignature: String?,
expectedGenericSignature: String
) {
private val expectedFormattedSignature = formatSignature(header, expectedJvmSignature, expectedGenericSignature) private val expectedFormattedSignature = formatSignature(header, expectedJvmSignature, expectedGenericSignature)
private val jvmDescriptorToFormattedSignature = mutableMapOf<String, String>() private val jvmDescriptorToFormattedSignature = mutableMapOf<String, String>()
@@ -44,11 +49,11 @@ abstract class AbstractWriteSignatureTest : CodegenTestCase() {
if (expectedJvmSignature == null) { if (expectedJvmSignature == null) {
Assert.assertTrue( Assert.assertTrue(
"Expected single declaration, but ${jvmDescriptorToFormattedSignature.keys} found", "Expected single declaration, but ${jvmDescriptorToFormattedSignature.keys} found",
jvmDescriptorToFormattedSignature.size == 1) jvmDescriptorToFormattedSignature.size == 1
)
jvmDescriptorToFormattedSignature.values.single() jvmDescriptorToFormattedSignature.values.single()
} } else {
else {
jvmDescriptorToFormattedSignature[expectedJvmSignature].sure { jvmDescriptorToFormattedSignature[expectedJvmSignature].sure {
"Expected $expectedJvmSignature but only ${jvmDescriptorToFormattedSignature.keys} found for $name" "Expected $expectedJvmSignature but only ${jvmDescriptorToFormattedSignature.keys} found for $name"
} }
@@ -114,12 +119,25 @@ abstract class AbstractWriteSignatureTest : CodegenTestCase() {
} }
private inner class Checker : ClassVisitor(Opcodes.ASM5) { private inner class Checker : ClassVisitor(Opcodes.ASM5) {
override fun visit(version: Int, access: Int, name: String, signature: String?, superName: String?, interfaces: Array<out String>?) { override fun visit(
version: Int,
access: Int,
name: String,
signature: String?,
superName: String?,
interfaces: Array<out String>?
) {
classExpectations.forEach { it.accept(name, name, signature ?: "null") } classExpectations.forEach { it.accept(name, name, signature ?: "null") }
super.visit(version, access, name, signature, superName, interfaces) super.visit(version, access, name, signature, superName, interfaces)
} }
override fun visitMethod(access: Int, name: String, desc: String, signature: String?, exceptions: Array<out String>?): MethodVisitor? { override fun visitMethod(
access: Int,
name: String,
desc: String,
signature: String?,
exceptions: Array<out String>?
): MethodVisitor? {
methodExpectations.forEach { it.accept(name, desc, signature ?: "null") } methodExpectations.forEach { it.accept(name, desc, signature ?: "null") }
return super.visitMethod(access, name, desc, signature, exceptions) return super.visitMethod(access, name, desc, signature, exceptions)
} }
@@ -180,12 +198,10 @@ abstract class AbstractWriteSignatureTest : CodegenTestCase() {
// Expectation, skip the following 'jvm signature' and 'generic signature' lines // Expectation, skip the following 'jvm signature' and 'generic signature' lines
lineNo += 3 lineNo += 3
} } else {
else {
throw AssertionError("$ktFile:${lineNo + 1}: '$kind' should be followed by 'jvm signature' and 'generic signature'") throw AssertionError("$ktFile:${lineNo + 1}: '$kind' should be followed by 'jvm signature' and 'generic signature'")
} }
} } else {
else {
++lineNo ++lineNo
} }
} }