@@ -30,6 +30,7 @@ import org.jetbrains.kotlin.fir.types.ConeKotlinType
30
30
import org.jetbrains.kotlin.fir.types.ConeNullability
31
31
import org.jetbrains.kotlin.fir.types.ConeStarProjection
32
32
import org.jetbrains.kotlin.fir.types.ConeTypeParameterType
33
+ import org.jetbrains.kotlin.fir.types.ConeTypeProjection
33
34
import org.jetbrains.kotlin.fir.types.canBeNull
34
35
import org.jetbrains.kotlin.fir.types.classId
35
36
import org.jetbrains.kotlin.fir.types.coneType
@@ -52,7 +53,6 @@ import org.jetbrains.kotlin.name.FqName
52
53
import org.jetbrains.kotlin.name.Name
53
54
import org.jetbrains.kotlin.name.StandardClassIds
54
55
import org.jetbrains.kotlin.name.StandardClassIds.List
55
- import org.jetbrains.kotlin.types.checker.SimpleClassicTypeSystemContext.withNullability
56
56
import org.jetbrains.kotlinx.dataframe.codeGen.*
57
57
import org.jetbrains.kotlinx.dataframe.plugin.extensions.KotlinTypeFacade
58
58
import org.jetbrains.kotlinx.dataframe.plugin.extensions.wrap
@@ -77,27 +77,32 @@ import java.util.*
77
77
class ToDataFrameDsl : AbstractSchemaModificationInterpreter () {
78
78
val Arguments .receiver: FirExpression ? by arg(lens = Interpreter .Id )
79
79
val Arguments .body by dsl()
80
+ val Arguments .typeArg0: ConeTypeProjection ? by arg(lens = Interpreter .Id )
81
+
80
82
override fun Arguments.interpret (): PluginDataFrameSchema {
81
83
val dsl = CreateDataFrameDslImplApproximation ()
82
- body(dsl, mapOf (" explicitReceiver" to Interpreter .Success (receiver)))
84
+ receiver
85
+ body(dsl, mapOf (" typeArg0" to Interpreter .Success (typeArg0)))
83
86
return PluginDataFrameSchema (dsl.columns)
84
87
}
85
88
}
86
89
87
90
class ToDataFrame : AbstractSchemaModificationInterpreter () {
88
91
val Arguments .receiver: FirExpression ? by arg(lens = Interpreter .Id )
89
92
val Arguments .maxDepth: Number by arg(defaultValue = Present (DEFAULT_MAX_DEPTH ))
93
+ val Arguments .typeArg0: ConeTypeProjection by arg(lens = Interpreter .Id )
90
94
91
95
override fun Arguments.interpret (): PluginDataFrameSchema {
92
- return toDataFrame(maxDepth.toInt(), receiver , TraverseConfiguration ())
96
+ return toDataFrame(maxDepth.toInt(), typeArg0 , TraverseConfiguration ())
93
97
}
94
98
}
95
99
96
100
class ToDataFrameDefault : AbstractSchemaModificationInterpreter () {
97
101
val Arguments .receiver: FirExpression ? by arg(lens = Interpreter .Id )
102
+ val Arguments .typeArg0: ConeTypeProjection by arg(lens = Interpreter .Id )
98
103
99
104
override fun Arguments.interpret (): PluginDataFrameSchema {
100
- return toDataFrame(DEFAULT_MAX_DEPTH , receiver , TraverseConfiguration ())
105
+ return toDataFrame(DEFAULT_MAX_DEPTH , typeArg0 , TraverseConfiguration ())
101
106
}
102
107
}
103
108
@@ -115,14 +120,14 @@ private const val DEFAULT_MAX_DEPTH = 0
115
120
116
121
class Properties0 : AbstractInterpreter <Unit >() {
117
122
val Arguments .dsl: CreateDataFrameDslImplApproximation by arg()
118
- val Arguments .explicitReceiver: FirExpression ? by arg()
119
123
val Arguments .maxDepth: Int by arg()
120
124
val Arguments .body by dsl()
125
+ val Arguments .typeArg0: ConeTypeProjection by arg(lens = Interpreter .Id )
121
126
122
127
override fun Arguments.interpret () {
123
128
dsl.configuration.maxDepth = maxDepth
124
129
body(dsl.configuration.traverseConfiguration, emptyMap())
125
- val schema = toDataFrame(dsl.configuration.maxDepth, explicitReceiver , dsl.configuration.traverseConfiguration)
130
+ val schema = toDataFrame(dsl.configuration.maxDepth, typeArg0 , dsl.configuration.traverseConfiguration)
126
131
dsl.columns.addAll(schema.columns())
127
132
}
128
133
}
@@ -178,8 +183,8 @@ class Exclude1 : AbstractInterpreter<Unit>() {
178
183
@OptIn(SymbolInternals ::class )
179
184
internal fun KotlinTypeFacade.toDataFrame (
180
185
maxDepth : Int ,
181
- explicitReceiver : FirExpression ? ,
182
- traverseConfiguration : TraverseConfiguration
186
+ arg : ConeTypeProjection ,
187
+ traverseConfiguration : TraverseConfiguration ,
183
188
): PluginDataFrameSchema {
184
189
fun ConeKotlinType.isValueType () =
185
190
this .isArrayTypeOrNullableArrayType ||
@@ -290,8 +295,6 @@ internal fun KotlinTypeFacade.toDataFrame(
290
295
}
291
296
}
292
297
293
- val receiver = explicitReceiver ? : return PluginDataFrameSchema .EMPTY
294
- val arg = receiver.resolvedType.typeArguments.firstOrNull() ? : return PluginDataFrameSchema .EMPTY
295
298
return when {
296
299
arg.isStarProjection -> PluginDataFrameSchema .EMPTY
297
300
else -> {
0 commit comments