Skip to content

Commit 7f3ba71

Browse files
committed
remove unused code / potential features
1 parent 8775465 commit 7f3ba71

File tree

2 files changed

+4
-84
lines changed

2 files changed

+4
-84
lines changed

core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/explainer/PluginCallback.kt

Lines changed: 4 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.jetbrains.kotlinx.dataframe.explainer
22

3-
import com.beust.klaxon.JsonObject
43
import org.jetbrains.kotlinx.dataframe.AnyCol
54
import org.jetbrains.kotlinx.dataframe.AnyFrame
65
import org.jetbrains.kotlinx.dataframe.DataFrame
@@ -22,7 +21,6 @@ import org.jetbrains.kotlinx.dataframe.api.Update
2221
import org.jetbrains.kotlinx.dataframe.api.format
2322
import org.jetbrains.kotlinx.dataframe.api.frames
2423
import org.jetbrains.kotlinx.dataframe.api.into
25-
import org.jetbrains.kotlinx.dataframe.api.print
2624
import org.jetbrains.kotlinx.dataframe.api.toDataFrame
2725
import org.jetbrains.kotlinx.dataframe.api.values
2826
import org.jetbrains.kotlinx.dataframe.api.where
@@ -88,11 +86,11 @@ object PluginCallback {
8886
when (statements.size) {
8987
0 -> TODO("function doesn't have any dataframe expression")
9088
1 -> {
91-
output += statementOutput(statements.values.single(), open = false)
89+
output += statementOutput(statements.values.single())
9290
}
9391
else -> {
9492
statements.forEach { (index, expressions) ->
95-
var details: DataFrameHtmlData = statementOutput(expressions, open = true)
93+
var details: DataFrameHtmlData = statementOutput(expressions)
9694

9795
details = details.copy(
9896
body =
@@ -123,10 +121,7 @@ object PluginCallback {
123121

124122
private fun statementOutput(
125123
expressions: List<Expression>,
126-
open: Boolean,
127124
): DataFrameHtmlData {
128-
// val attribute = if (open) " open" else ""
129-
val attribute = ""
130125
var data = DataFrameHtmlData()
131126
if (expressions.size < 2) error("Sample without output or input (i.e. function returns some value)")
132127
for ((i, expression) in expressions.withIndex()) {
@@ -135,7 +130,7 @@ object PluginCallback {
135130
val table = convertToHTML(expression.df)
136131
val description = table.copy(
137132
body = """
138-
<details$attribute>
133+
<details>
139134
<summary>Input ${convertToDescription(expression.df)}</summary>
140135
${table.body}
141136
</details>
@@ -148,7 +143,7 @@ object PluginCallback {
148143
val table = convertToHTML(expression.df)
149144
val description = table.copy(
150145
body = """
151-
<details$attribute>
146+
<details>
152147
<summary>Output ${convertToDescription(expression.df)}</summary>
153148
${table.body}
154149
</details>
@@ -180,41 +175,6 @@ object PluginCallback {
180175
val element = Expression(source, containingClassFqName, containingFunName, df)
181176
list?.plus(element) ?: listOf(element)
182177
}
183-
// strings.add(string)
184-
// names.add(name)
185-
// Can be called with the same name multiple times, need to aggregate samples by function name somehow?
186-
// save schema
187-
val path = "$containingClassFqName.$containingFunName.html"
188-
// names.compute(path) { }
189-
// dfs.add(path)
190-
if (df is AnyFrame) {
191-
println(source)
192-
// df.print()
193-
println(id)
194-
println(receiverId)
195-
} else {
196-
println(df::class)
197-
}
198-
File("build/out").let {
199-
val json = JsonObject(
200-
mapOf(
201-
"string" to source,
202-
"name" to name,
203-
"path" to path,
204-
"id" to id,
205-
"receiverId" to receiverId,
206-
)
207-
).toJsonString()
208-
it.appendText(json)
209-
it.appendText(",\n")
210-
}
211-
println(path)
212-
if (df is AnyFrame) {
213-
df.print()
214-
} else {
215-
println(df::class)
216-
}
217-
// convertToHTML(df).writeHTML(File("build/dataframes/$path"))
218178
}
219179

220180
@Suppress("unused")

plugins/expressions-converter/src/org/jetbrains/kotlinx/dataframe/ExplainerIrTransformer.kt

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@ import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
1414
import org.jetbrains.kotlin.ir.declarations.IrField
1515
import org.jetbrains.kotlin.ir.declarations.IrFile
1616
import org.jetbrains.kotlin.ir.declarations.IrFunction
17-
import org.jetbrains.kotlin.ir.declarations.IrVariable
1817
import org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl
1918
import org.jetbrains.kotlin.ir.declarations.impl.IrValueParameterImpl
2019
import org.jetbrains.kotlin.ir.declarations.path
2120
import org.jetbrains.kotlin.ir.expressions.IrBlockBody
2221
import org.jetbrains.kotlin.ir.expressions.IrBody
2322
import org.jetbrains.kotlin.ir.expressions.IrCall
24-
import org.jetbrains.kotlin.ir.expressions.IrConstKind
2523
import org.jetbrains.kotlin.ir.expressions.IrDeclarationReference
2624
import org.jetbrains.kotlin.ir.expressions.IrExpression
2725
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
@@ -35,7 +33,6 @@ import org.jetbrains.kotlin.ir.expressions.impl.IrGetValueImpl
3533
import org.jetbrains.kotlin.ir.symbols.impl.IrSimpleFunctionSymbolImpl
3634
import org.jetbrains.kotlin.ir.symbols.impl.IrValueParameterSymbolImpl
3735
import org.jetbrains.kotlin.ir.types.classFqName
38-
import org.jetbrains.kotlin.ir.types.classOrNull
3936
import org.jetbrains.kotlin.ir.types.defaultType
4037
import org.jetbrains.kotlin.ir.types.makeNullable
4138
import org.jetbrains.kotlin.ir.types.typeWith
@@ -269,41 +266,4 @@ class ExplainerIrTransformer(val pluginContext: IrPluginContext) : FileLoweringP
269266
val column = file.fileEntry.getColumnNumber(expression.startOffset)
270267
return "${file.path}:${line + 1}:${column + 1}"
271268
}
272-
273-
@OptIn(FirIncompatiblePluginAPI::class)
274-
private fun transformPrint(expression: IrCall): IrCallImpl {
275-
val message = when (val arg = expression.getValueArgument(0)) {
276-
is IrGetValue -> {
277-
val irVariable = arg.symbol.owner as? IrVariable
278-
if (irVariable != null) {
279-
irVariable.initializer?.let {
280-
source.substring(it.startOffset, it.endOffset)
281-
}
282-
} else null
283-
}
284-
285-
else -> null
286-
}
287-
val to = pluginContext.referenceFunctions(FqName("kotlin.to")).single()
288-
val toCall = IrCallImpl(
289-
-1,
290-
-1,
291-
to.owner.returnType.classOrNull?.typeWith(
292-
pluginContext.irBuiltIns.stringType,
293-
expression.getValueArgument(0)!!.type
294-
)!!,
295-
to,
296-
0,
297-
1
298-
).apply {
299-
extensionReceiver = IrConstImpl(-1, -1, pluginContext.irBuiltIns.stringType, IrConstKind.String, message!!)
300-
putValueArgument(0, expression.getValueArgument(0)!!)
301-
}
302-
val printM =
303-
pluginContext.referenceFunctions(FqName("org.jetbrains.kotlinx.dataframe.explainer.printM")).single()
304-
val printMCall = IrCallImpl(-1, -1, printM.owner.returnType, printM, 0, 1).apply {
305-
putValueArgument(0, toCall)
306-
}
307-
return printMCall
308-
}
309269
}

0 commit comments

Comments
 (0)