提交 1dbe7d12 编写于 作者: S Shagen Ogandzhanian 提交者: TeamCityServer

Simplify concatElements resolution for size=0 and size=1 cases

^KT-40689 fixed
上级 bcfc0c21
...@@ -240,15 +240,18 @@ fun argumentsWithVarargAsSingleArray( ...@@ -240,15 +240,18 @@ fun argumentsWithVarargAsSingleArray(
} }
} }
if (arraysForConcat.isNotEmpty() || concatElements.isEmpty()) { if (arraysForConcat.isNotEmpty()) {
concatElements.add(JsArrayLiteral(arraysForConcat)) concatElements.add(JsArrayLiteral(arraysForConcat))
} }
return concatElements.singleOrNull() return when (concatElements.size) {
?: JsInvocation( 0 -> JsArrayLiteral()
1 -> concatElements[0]
else -> JsInvocation(
JsNameRef("concat", concatElements.first()), JsNameRef("concat", concatElements.first()),
concatElements.drop(1) concatElements.drop(1)
) )
}
} }
fun IrFunction.varargParameterIndex() = valueParameters.indexOfFirst { it.varargElementType != null } fun IrFunction.varargParameterIndex() = valueParameters.indexOfFirst { it.varargElementType != null }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册