@@ -78,6 +78,7 @@ import org.jetbrains.kotlinx.dataframe.plugin.impl.SimpleColumnGroup
78
78
import org.jetbrains.kotlinx.dataframe.plugin.impl.SimpleFrameColumn
79
79
import org.jetbrains.kotlinx.dataframe.plugin.impl.api.ColumnsResolver
80
80
import org.jetbrains.kotlinx.dataframe.plugin.impl.api.SingleColumnApproximation
81
+ import org.jetbrains.kotlinx.dataframe.plugin.impl.api.TypeApproximation
81
82
82
83
fun <T > KotlinTypeFacade.interpret (
83
84
functionCall : FirFunctionCall ,
@@ -374,19 +375,23 @@ private fun KotlinTypeFacade.columnWithPathApproximations(result: FirPropertyAcc
374
375
}
375
376
}
376
377
377
- private fun KotlinTypeFacade.columnOf (it : FirPropertySymbol , mapping : Map <FirTypeParameterSymbol , ConeTypeProjection >): SimpleCol ? =
378
- when {
378
+ private fun KotlinTypeFacade.columnOf (it : FirPropertySymbol , mapping : Map <FirTypeParameterSymbol , ConeTypeProjection >): SimpleCol ? {
379
+ val annotation = it.getAnnotationByClassId(Names .COLUMN_NAME_ANNOTATION , session)
380
+ val columnName = (annotation?.argumentMapping?.mapping?.get(Names .COLUMN_NAME_ARGUMENT ) as ? FirLiteralExpression )?.value as ? String
381
+ val name = columnName ? : it.name.identifier
382
+ return when {
379
383
shouldBeConvertedToFrameColumn(it) -> {
380
- val nestedColumns = it.resolvedReturnType.typeArguments[0 ].type
381
- ?.toRegularClassSymbol(session)
382
- ?.declaredMemberScope(session, FirResolvePhase .DECLARATIONS )
383
- ?.collectAllProperties()
384
- ?.filterIsInstance<FirPropertySymbol >()
385
- ?.mapNotNull { columnOf(it, mapping) }
386
- ? : emptyList()
387
-
388
- SimpleFrameColumn (it.name.identifier, nestedColumns)
389
- }
384
+ val nestedColumns = it.resolvedReturnType.typeArguments[0 ].type
385
+ ?.toRegularClassSymbol(session)
386
+ ?.declaredMemberScope(session, FirResolvePhase .DECLARATIONS )
387
+ ?.collectAllProperties()
388
+ ?.filterIsInstance<FirPropertySymbol >()
389
+ ?.mapNotNull { columnOf(it, mapping) }
390
+ ? : emptyList()
391
+
392
+ SimpleFrameColumn (name, nestedColumns)
393
+ }
394
+
390
395
shouldBeConvertedToColumnGroup(it) -> {
391
396
val type = if (isDataRow(it)) it.resolvedReturnType.typeArguments[0 ].type!! else it.resolvedReturnType
392
397
val nestedColumns = type
@@ -396,8 +401,9 @@ private fun KotlinTypeFacade.columnOf(it: FirPropertySymbol, mapping: Map<FirTyp
396
401
?.filterIsInstance<FirPropertySymbol >()
397
402
?.mapNotNull { columnOf(it, mapping) }
398
403
? : emptyList()
399
- SimpleColumnGroup (it. name.identifier , nestedColumns)
404
+ SimpleColumnGroup (name, nestedColumns)
400
405
}
406
+
401
407
else -> {
402
408
val type = when (val type = it.resolvedReturnType) {
403
409
is ConeTypeParameterType -> {
@@ -408,13 +414,15 @@ private fun KotlinTypeFacade.columnOf(it: FirPropertySymbol, mapping: Map<FirTyp
408
414
projection as ? ConeKotlinType
409
415
}
410
416
}
417
+
411
418
else -> type
412
419
}
413
- type?.let { type -> SimpleDataColumn (it.name.identifier,
414
- org.jetbrains.kotlinx.dataframe.plugin.impl.api. TypeApproximation (type)
415
- ) }
420
+ type?.let { type ->
421
+ SimpleDataColumn (name, TypeApproximation (type) )
422
+ }
416
423
}
417
424
}
425
+ }
418
426
419
427
private fun KotlinTypeFacade.shouldBeConvertedToColumnGroup (it : FirPropertySymbol ) =
420
428
isDataRow(it) ||
0 commit comments