Code cleanup: unnecessary local variable applied
This commit is contained in:
@@ -378,11 +378,10 @@ internal class ExpressionDecomposer private constructor(
|
||||
get() = name.makeRef()
|
||||
|
||||
fun assign(value: JsExpression): JsStatement {
|
||||
val statement = JsExpressionStatement(assignment(nameRef, value)).apply {
|
||||
return JsExpressionStatement(assignment(nameRef, value)).apply {
|
||||
synthetic = true
|
||||
expression.source = sourceInfo ?: value.source
|
||||
}
|
||||
return statement
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -51,8 +51,7 @@ object ExceptionPropertyIntrinsicFactory : FunctionIntrinsicFactory {
|
||||
.getContributedDescriptors(DescriptorKindFilter.CALLABLES)
|
||||
.filterIsInstance<PropertyDescriptor>()
|
||||
.first { it.overriddenDescriptors.any { it == property } }
|
||||
val fieldRef = JsAstUtils.pureFqn(context.getNameForBackingField(currentClassProperty), callInfo.dispatchReceiver!!)
|
||||
return fieldRef
|
||||
return JsAstUtils.pureFqn(context.getNameForBackingField(currentClassProperty), callInfo.dispatchReceiver!!)
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
-10
@@ -124,18 +124,15 @@ object EqualsBOIF : BinaryOperationIntrinsicFactory {
|
||||
|
||||
override fun getSupportTokens() = OperatorConventions.EQUALS_OPERATIONS!!
|
||||
|
||||
override fun getIntrinsic(descriptor: FunctionDescriptor, leftType: KotlinType?, rightType: KotlinType?): BinaryOperationIntrinsic? {
|
||||
val result = when {
|
||||
isEnumIntrinsicApplicable(descriptor, leftType, rightType) -> EnumEqualsIntrinsic
|
||||
override fun getIntrinsic(descriptor: FunctionDescriptor, leftType: KotlinType?, rightType: KotlinType?): BinaryOperationIntrinsic? =
|
||||
when {
|
||||
isEnumIntrinsicApplicable(descriptor, leftType, rightType) -> EnumEqualsIntrinsic
|
||||
|
||||
KotlinBuiltIns.isBuiltIn(descriptor) ||
|
||||
TopLevelFIF.EQUALS_IN_ANY.test(descriptor) -> EqualsIntrinsic
|
||||
KotlinBuiltIns.isBuiltIn(descriptor) ||
|
||||
TopLevelFIF.EQUALS_IN_ANY.test(descriptor) -> EqualsIntrinsic
|
||||
|
||||
else -> null
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
else -> null
|
||||
}
|
||||
|
||||
private fun isEnumIntrinsicApplicable(descriptor: FunctionDescriptor, leftType: KotlinType?, rightType: KotlinType?): Boolean {
|
||||
return DescriptorUtils.isEnumClass(descriptor.containingDeclaration) && leftType != null && rightType != null &&
|
||||
|
||||
@@ -125,7 +125,7 @@ fun <T, S> List<T>.splitToRanges(classifier: (T) -> S): List<Pair<List<T>, S>> {
|
||||
fun getReferenceToJsClass(type: KotlinType, context: TranslationContext): JsExpression {
|
||||
val classifierDescriptor = type.constructor.declarationDescriptor
|
||||
|
||||
val referenceToJsClass: JsExpression = when (classifierDescriptor) {
|
||||
return when (classifierDescriptor) {
|
||||
is ClassDescriptor -> {
|
||||
ReferenceTranslator.translateAsTypeReference(classifierDescriptor, context)
|
||||
}
|
||||
@@ -140,8 +140,6 @@ fun getReferenceToJsClass(type: KotlinType, context: TranslationContext): JsExpr
|
||||
throw IllegalStateException("Can't get reference for $type")
|
||||
}
|
||||
}
|
||||
|
||||
return referenceToJsClass
|
||||
}
|
||||
|
||||
fun TranslationContext.addFunctionToPrototype(
|
||||
|
||||
Reference in New Issue
Block a user