Minor: reformat

This commit is contained in:
Dmitry Petrov
2018-10-04 17:10:43 +03:00
parent 9a31e04062
commit 8fc6b91f66
@@ -21,10 +21,10 @@ import org.jetbrains.org.objectweb.asm.Type
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
class CoercionValue( class CoercionValue(
val value: StackValue, val value: StackValue,
private val castType: Type, private val castType: Type,
private val castKotlinType: KotlinType?, private val castKotlinType: KotlinType?,
private val underlyingKotlinType: KotlinType? // type of the underlying parameter for inline class private val underlyingKotlinType: KotlinType? // type of the underlying parameter for inline class
) : StackValue(castType, castKotlinType, value.canHaveSideEffects()) { ) : StackValue(castType, castKotlinType, value.canHaveSideEffects()) {
override fun putSelector(type: Type, kotlinType: KotlinType?, v: InstructionAdapter) { override fun putSelector(type: Type, kotlinType: KotlinType?, v: InstructionAdapter) {
@@ -55,8 +55,8 @@ class CoercionValue(
class StackValueWithLeaveTask( class StackValueWithLeaveTask(
val stackValue: StackValue, val stackValue: StackValue,
val leaveTasks: (StackValue) -> Unit val leaveTasks: (StackValue) -> Unit
) : StackValue(stackValue.type, stackValue.kotlinType) { ) : StackValue(stackValue.type, stackValue.kotlinType) {
override fun putReceiver(v: InstructionAdapter, isRead: Boolean) { override fun putReceiver(v: InstructionAdapter, isRead: Boolean) {
@@ -89,22 +89,22 @@ class FunctionCallStackValue(
fun ValueParameterDescriptor.findJavaDefaultArgumentValue(targetType: Type, typeMapper: KotlinTypeMapper): StackValue { fun ValueParameterDescriptor.findJavaDefaultArgumentValue(targetType: Type, typeMapper: KotlinTypeMapper): StackValue {
val descriptorWithDefaultValue = DFS.dfs( val descriptorWithDefaultValue = DFS.dfs(
listOf(this.original), listOf(this.original),
{ it.original.overriddenDescriptors.map(ValueParameterDescriptor::getOriginal) }, { it.original.overriddenDescriptors.map(ValueParameterDescriptor::getOriginal) },
object : DFS.AbstractNodeHandler<ValueParameterDescriptor, ValueParameterDescriptor?>() { object : DFS.AbstractNodeHandler<ValueParameterDescriptor, ValueParameterDescriptor?>() {
var result: ValueParameterDescriptor? = null var result: ValueParameterDescriptor? = null
override fun beforeChildren(current: ValueParameterDescriptor?): Boolean { override fun beforeChildren(current: ValueParameterDescriptor?): Boolean {
if (current?.declaresDefaultValue() == true && current.getDefaultValueFromAnnotation() != null) { if (current?.declaresDefaultValue() == true && current.getDefaultValueFromAnnotation() != null) {
result = current result = current
return false return false
}
return true
} }
override fun result(): ValueParameterDescriptor? = result return true
} }
override fun result(): ValueParameterDescriptor? = result
}
) ?: error("Should be at least one descriptor with default value: $this") ) ?: error("Should be at least one descriptor with default value: $this")
val defaultValue = descriptorWithDefaultValue.getDefaultValueFromAnnotation() val defaultValue = descriptorWithDefaultValue.getDefaultValueFromAnnotation()