File tree Expand file tree Collapse file tree 5 files changed +12
-9
lines changed
plugins/kotlin-dataframe/src/org/jetbrains/kotlinx/dataframe/plugin Expand file tree Collapse file tree 5 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,9 @@ import org.jetbrains.kotlinx.dataframe.plugin.utils.Names
18
18
data class PluginDataFrameSchema (
19
19
private val columns : List <SimpleCol >
20
20
) : DataFrameLikeContainer<SimpleCol> {
21
+ companion object {
22
+ val EMPTY = PluginDataFrameSchema (emptyList())
23
+ }
21
24
override fun columns (): List <SimpleCol > {
22
25
return columns
23
26
}
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ fun KotlinTypeFacade.aggregate(
92
92
}
93
93
PluginDataFrameSchema (cols)
94
94
} else {
95
- PluginDataFrameSchema (emptyList())
95
+ PluginDataFrameSchema . EMPTY
96
96
}
97
97
}
98
98
Original file line number Diff line number Diff line change @@ -132,7 +132,7 @@ internal fun PluginDataFrameSchema.insertImpl(
132
132
columns.firstOrNull()?.referenceNode?.getRoot(),
133
133
0 ,
134
134
factory = { PluginDataFrameSchema (it) },
135
- empty = PluginDataFrameSchema (emptyList()) ,
135
+ empty = PluginDataFrameSchema . EMPTY ,
136
136
rename = { rename(it) },
137
137
createColumnGroup = { name, columns ->
138
138
SimpleColumnGroup (name, columns)
Original file line number Diff line number Diff line change @@ -288,12 +288,12 @@ internal fun KotlinTypeFacade.toDataFrame(
288
288
}
289
289
}
290
290
291
- val receiver = explicitReceiver ? : return PluginDataFrameSchema (emptyList())
292
- val arg = receiver.resolvedType.typeArguments.firstOrNull() ? : return PluginDataFrameSchema (emptyList())
291
+ val receiver = explicitReceiver ? : return PluginDataFrameSchema . EMPTY
292
+ val arg = receiver.resolvedType.typeArguments.firstOrNull() ? : return PluginDataFrameSchema . EMPTY
293
293
return when {
294
- arg.isStarProjection -> PluginDataFrameSchema (emptyList())
294
+ arg.isStarProjection -> PluginDataFrameSchema . EMPTY
295
295
else -> {
296
- val classLike = arg.type as ? ConeClassLikeType ? : return PluginDataFrameSchema (emptyList())
296
+ val classLike = arg.type as ? ConeClassLikeType ? : return PluginDataFrameSchema . EMPTY
297
297
val columns = convert(classLike, 0 )
298
298
PluginDataFrameSchema (columns)
299
299
}
Original file line number Diff line number Diff line change @@ -314,16 +314,16 @@ interface InterpretationErrorReporter {
314
314
315
315
fun KotlinTypeFacade.pluginDataFrameSchema (schemaTypeArg : ConeTypeProjection ): PluginDataFrameSchema {
316
316
val schema = if (schemaTypeArg.isStarProjection) {
317
- PluginDataFrameSchema (emptyList())
317
+ PluginDataFrameSchema . EMPTY
318
318
} else {
319
- val coneClassLikeType = schemaTypeArg.type as ? ConeClassLikeType ? : return PluginDataFrameSchema (emptyList())
319
+ val coneClassLikeType = schemaTypeArg.type as ? ConeClassLikeType ? : return PluginDataFrameSchema . EMPTY
320
320
pluginDataFrameSchema(coneClassLikeType)
321
321
}
322
322
return schema
323
323
}
324
324
325
325
fun KotlinTypeFacade.pluginDataFrameSchema (coneClassLikeType : ConeClassLikeType ): PluginDataFrameSchema {
326
- val symbol = coneClassLikeType.toSymbol(session) as ? FirRegularClassSymbol ? : return PluginDataFrameSchema (emptyList())
326
+ val symbol = coneClassLikeType.toSymbol(session) as ? FirRegularClassSymbol ? : return PluginDataFrameSchema . EMPTY
327
327
val declarationSymbols = if (symbol.isLocal && symbol.resolvedSuperTypes.firstOrNull() != session.builtinTypes.anyType.type) {
328
328
val rootSchemaSymbol = symbol.resolvedSuperTypes.first().toSymbol(session) as ? FirRegularClassSymbol
329
329
rootSchemaSymbol?.declaredMemberScope(session, FirResolvePhase .DECLARATIONS )
You can’t perform that action at this time.
0 commit comments