Skip to content

Commit

Permalink
arrow-kt#58: clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
rcd27 committed Jul 30, 2022
1 parent 8c6280a commit 728ee0b
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 70 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
package io.arrowkt.example

/**
* Use this annotation for [io.arrowkt.example.MetaPlugin] plugin to inject logic to function
*/
annotation class MetaLog
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
package io.arrowkt.example

@Suppress("unused")
object MetaLogger {

/**
* Called by [io.arrowkt.example.MetaPlugin] during IR transformation
*/
@Suppress("unused")
fun log() {
println("MetaLogger.log() invoked")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ import org.jetbrains.kotlin.ir.util.hasAnnotation
import org.jetbrains.kotlin.ir.util.statements
import org.jetbrains.kotlin.name.FqName

val Meta.addAnnotatedLogging: CliPlugin
val Meta.addLoggingToAnnotatedFunctions: CliPlugin
get() = "Add Logging To Annotated Functions" {
meta(
irFunction { declaration ->

// FIXME #58: NoClassDefFound when trying to access via MetaLog::class.qualifiedName
return@irFunction if (declaration.hasAnnotation(FqName("io.arrowkt.example.MetaLog"))) {
declaration.body = prependLoggingToBody(pluginContext, declaration)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ class MetaPlugin : Meta {
@ExperimentalContracts
override fun intercept(ctx: CompilerContext): List<CliPlugin> =
listOf(
/* 58: unquote
transformNewSources
*/
addAnnotatedLogging
addLoggingToAnnotatedFunctions
)
}

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 728ee0b

Please sign in to comment.