More cleanup: lift return / assignment out

This commit is contained in:
Mikhail Glukhikh
2017-07-07 13:57:36 +03:00
parent 9269de721e
commit dfe2c16bc7
116 changed files with 472 additions and 517 deletions
@@ -106,8 +106,8 @@ private fun StringBuilder.encodeForSignature(
parameter: TypeParameterDescriptor,
typeParameterNamer: (TypeParameterDescriptor) -> String
): StringBuilder {
if (projection.isStarProjection) {
return append("*")
return if (projection.isStarProjection) {
append("*")
}
else {
when (getEffectiveVariance(parameter.variance, projection.projectionKind)) {
@@ -115,7 +115,7 @@ private fun StringBuilder.encodeForSignature(
Variance.OUT_VARIANCE -> append("+")
Variance.INVARIANT -> {}
}
return encodeForSignature(projection.type, typeParameterNamer)
encodeForSignature(projection.type, typeParameterNamer)
}
}
@@ -224,12 +224,10 @@ private fun JsFunction.markInlineArguments(descriptor: CallableDescriptor) {
val visitor = object: JsVisitorWithContextImpl() {
override fun endVisit(x: JsInvocation, ctx: JsContext<*>) {
val qualifier: JsExpression?
if (isCallInvocation(x)) {
qualifier = (x.qualifier as? JsNameRef)?.qualifier
val qualifier: JsExpression? = if (isCallInvocation(x)) {
(x.qualifier as? JsNameRef)?.qualifier
} else {
qualifier = x.qualifier
x.qualifier
}
(qualifier as? JsNameRef)?.name?.let { name ->
@@ -30,12 +30,12 @@ object DynamicTypeDeserializer : FlexibleTypeDeserializer {
override fun create(proto: ProtoBuf.Type, flexibleId: String, lowerBound: SimpleType, upperBound: SimpleType): KotlinType {
if (flexibleId != id) return ErrorUtils.createErrorType("Unexpected id: $flexibleId. ($lowerBound..$upperBound)")
if (StrictEqualityTypeChecker.strictEqualTypes(lowerBound, lowerBound.builtIns.nothingType) &&
StrictEqualityTypeChecker.strictEqualTypes(upperBound, upperBound.builtIns.nullableAnyType)) {
return createDynamicType(lowerBound.builtIns)
return if (StrictEqualityTypeChecker.strictEqualTypes(lowerBound, lowerBound.builtIns.nothingType) &&
StrictEqualityTypeChecker.strictEqualTypes(upperBound, upperBound.builtIns.nullableAnyType)) {
createDynamicType(lowerBound.builtIns)
}
else {
return ErrorUtils.createErrorType("Illegal type range for dynamic type: $lowerBound..$upperBound")
ErrorUtils.createErrorType("Illegal type range for dynamic type: $lowerBound..$upperBound")
}
}
}