[FIR2IR] Add initial support of collection literals
This commit is contained in:
@@ -756,6 +756,19 @@ class Fir2IrVisitor(
|
||||
}
|
||||
}
|
||||
|
||||
override fun visitArrayOfCall(arrayOfCall: FirArrayOfCall, data: Any?): IrElement {
|
||||
return arrayOfCall.convertWithOffsets { startOffset, endOffset ->
|
||||
IrVarargImpl(
|
||||
startOffset, endOffset,
|
||||
type = arrayOfCall.arguments.firstOrNull()?.typeRef?.toIrType() ?: createErrorType(),
|
||||
varargElementType = arrayOfCall.typeRef.toIrType(),
|
||||
elements = arrayOfCall.arguments.map {
|
||||
convertToIrExpression(it)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun visitAugmentedArraySetCall(augmentedArraySetCall: FirAugmentedArraySetCall, data: Any?): IrElement {
|
||||
return augmentedArraySetCall.convertWithOffsets { startOffset, endOffset ->
|
||||
IrErrorCallExpressionImpl(
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_REFLECT
|
||||
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_REFLECT
|
||||
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
Vendored
+3
@@ -84,4 +84,7 @@ FILE fqName:<root> fileName:/annotationsInAnnotationArguments.kt
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
annotations:
|
||||
A2(a = A1(x = '42'))
|
||||
AA(xs = [A1(x = '1'), A1(x = '2')])
|
||||
BLOCK_BODY
|
||||
|
||||
+6
@@ -56,6 +56,12 @@ FILE fqName:<root> fileName:/arrayInAnnotationArguments.kt
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN name:test1 visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
annotations:
|
||||
TestAnnWithIntArray(x = CALL 'public final fun intArrayOf (vararg elements: kotlin.Int): kotlin.IntArray declared in kotlin' type=kotlin.IntArray origin=null)
|
||||
TestAnnWithStringArray(x = CALL 'public final fun arrayOf <T> (vararg elements: T of kotlin.arrayOf): kotlin.Array<T of kotlin.arrayOf> [inline] declared in kotlin' type=kotlin.Array<kotlin.String> origin=null)
|
||||
BLOCK_BODY
|
||||
FUN name:test2 visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
annotations:
|
||||
TestAnnWithIntArray(x = ['4', '5', '6'])
|
||||
TestAnnWithStringArray(x = ['d', 'e', 'f'])
|
||||
BLOCK_BODY
|
||||
|
||||
Reference in New Issue
Block a user