@@ -13,8 +13,6 @@ import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
13
13
import org.jetbrains.kotlin.ir.declarations.IrField
14
14
import org.jetbrains.kotlin.ir.declarations.IrFile
15
15
import org.jetbrains.kotlin.ir.declarations.IrFunction
16
- import org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl
17
- import org.jetbrains.kotlin.ir.declarations.impl.IrValueParameterImpl
18
16
import org.jetbrains.kotlin.ir.declarations.path
19
17
import org.jetbrains.kotlin.ir.expressions.IrBlockBody
20
18
import org.jetbrains.kotlin.ir.expressions.IrBody
@@ -41,6 +39,8 @@ import org.jetbrains.kotlin.ir.util.isLocal
41
39
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
42
40
import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
43
41
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
42
+ import org.jetbrains.kotlin.name.CallableId
43
+ import org.jetbrains.kotlin.name.ClassId
44
44
import org.jetbrains.kotlin.name.FqName
45
45
import org.jetbrains.kotlin.name.Name
46
46
import java.io.File
@@ -125,6 +125,8 @@ class ExplainerIrTransformer(
125
125
FqName (" org.jetbrains.kotlinx.dataframe.DataRow" )
126
126
)
127
127
128
+ val explainerPackage = FqName (" org.jetbrains.kotlinx.dataframe.explainer" )
129
+
128
130
override fun visitGetValue (expression : IrGetValue , data : ContainingDeclarations ): IrExpression {
129
131
if (expression.startOffset < 0 ) return expression
130
132
if (expression.type.classFqName in dataFrameLike) {
@@ -155,21 +157,20 @@ class ExplainerIrTransformer(
155
157
return super .visitExpression(expression, data)
156
158
}
157
159
158
- @OptIn(FirIncompatiblePluginAPI ::class )
159
160
private fun transformDataFrameExpression (
160
161
expression : IrDeclarationReference ,
161
162
ownerName : Name ,
162
163
receiver : IrExpression ? ,
163
164
data : ContainingDeclarations
164
165
): IrCall {
165
- val alsoReference = pluginContext.referenceFunctions(FqName (" kotlin. also" )).single()
166
+ val alsoReference = pluginContext.referenceFunctions(CallableId ( FqName (" kotlin" ), Name .identifier( " also" ) )).single()
166
167
167
168
val result = IrCallImpl (- 1 , - 1 , expression.type, alsoReference, 1 , 1 ).apply {
168
169
this .extensionReceiver = expression
169
170
putTypeArgument(0 , expression.type)
170
171
171
172
val symbol = IrSimpleFunctionSymbolImpl ()
172
- val alsoLambda = IrFunctionImpl (
173
+ val alsoLambda = pluginContext.irFactory.createSimpleFunction (
173
174
startOffset = - 1 ,
174
175
endOffset = - 1 ,
175
176
origin = IrDeclarationOrigin .LOCAL_FUNCTION_FOR_LAMBDA ,
@@ -188,7 +189,7 @@ class ExplainerIrTransformer(
188
189
).apply {
189
190
valueParameters = buildList {
190
191
add(
191
- IrValueParameterImpl (
192
+ pluginContext.irFactory.createValueParameter (
192
193
startOffset = - 1 ,
193
194
endOffset = - 1 ,
194
195
origin = IrDeclarationOrigin .DEFINED ,
@@ -223,8 +224,12 @@ class ExplainerIrTransformer(
223
224
add(IrConstImpl .int(- 1 , - 1 , pluginContext.irBuiltIns.intType, data.statementIndex))
224
225
}
225
226
body = pluginContext.irFactory.createBlockBody(- 1 , - 1 ).apply {
226
- val callback = FqName (" org.jetbrains.kotlinx.dataframe.explainer.PluginCallbackProxy.doAction" )
227
- val doAction = pluginContext.referenceFunctions(callback).single()
227
+ val callableId = CallableId (
228
+ explainerPackage,
229
+ FqName (" PluginCallbackProxy" ),
230
+ Name .identifier(" doAction" )
231
+ )
232
+ val doAction = pluginContext.referenceFunctions(callableId).single()
228
233
statements + = IrCallImpl (
229
234
startOffset = - 1 ,
230
235
endOffset = - 1 ,
@@ -233,7 +238,7 @@ class ExplainerIrTransformer(
233
238
typeArgumentsCount = 0 ,
234
239
valueArgumentsCount = valueArguments.size
235
240
).apply {
236
- val clazz = FqName ( " org.jetbrains.kotlinx.dataframe.explainer. PluginCallbackProxy" )
241
+ val clazz = ClassId (explainerPackage, Name .identifier( " PluginCallbackProxy" ) )
237
242
val plugin = pluginContext.referenceClass(clazz)!!
238
243
dispatchReceiver = IrGetObjectValueImpl (- 1 , - 1 , plugin.defaultType, plugin)
239
244
valueArguments.forEachIndexed { i, argument ->
0 commit comments