FIR2IR: simplify applyAssigningArrayElementsToVarargInNamedForm a bit
This commit is contained in:
committed by
Space Team
parent
4913c38e98
commit
e747793e62
+5
-11
@@ -1065,20 +1065,14 @@ class CallAndReferenceGenerator(
|
|||||||
argument: FirExpression,
|
argument: FirExpression,
|
||||||
parameter: FirValueParameter?,
|
parameter: FirValueParameter?,
|
||||||
): IrExpression {
|
): IrExpression {
|
||||||
if (this !is IrVarargImpl ||
|
if (this is IrVararg && parameter?.isVararg == true && argument is FirVarargArgumentsExpression && elements.size == 1) {
|
||||||
parameter?.isVararg != true ||
|
val irVarargElement = elements[0]
|
||||||
argument !is FirVarargArgumentsExpression ||
|
if (argument.arguments[0] is FirNamedArgumentExpression &&
|
||||||
argument.arguments.none { it is FirNamedArgumentExpression }
|
// IrVarargElement can be either IrSpreadElement (then nothing to do) or IrExpression
|
||||||
) {
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
elements.forEachIndexed { i, irVarargElement ->
|
|
||||||
if (irVarargElement !is IrSpreadElement &&
|
|
||||||
argument.arguments[i] is FirNamedArgumentExpression &&
|
|
||||||
irVarargElement is IrExpression &&
|
irVarargElement is IrExpression &&
|
||||||
(irVarargElement.type.isArray() || irVarargElement.type.isPrimitiveArray())
|
(irVarargElement.type.isArray() || irVarargElement.type.isPrimitiveArray())
|
||||||
) {
|
) {
|
||||||
elements[i] = IrSpreadElementImpl(irVarargElement.startOffset, irVarargElement.endOffset, irVarargElement)
|
elements[0] = IrSpreadElementImpl(irVarargElement.startOffset, irVarargElement.endOffset, irVarargElement)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this
|
return this
|
||||||
|
|||||||
Reference in New Issue
Block a user