compiler-plugin / arrow.meta / CliPlugin


typealias CliPlugin = Plugin<CompilerContext>

An Arrow Meta CliPlugin is a named function that given a CompilerContext produces a List of ExtensionPhase.

The following plugin named "Hello World" returns a single func extension phase that produces a transformation on the user tree.

In this simple plugin we are replacing all functions named helloWorld with a new function that prints “Hello ΛRROW Meta!” when invoked.

val Meta.helloWorld: CliPlugin get() =
  "Hello World" {
      namedFunction(this, { name == "helloWorld" }) { c ->  // <-- namedFunction(...) {...}
          replacing = c,
          newDeclaration = """|fun helloWorld(): Unit =
                              |  println("Hello ΛRROW Meta!")

func is part of the arrow.meta.quotes.Quote DSL, a high level DSL built for tree transformations. While most use cases can be covered by the Quote DSL you can also subscribe to the low level compiler phases such as Configuration, Analysis, Resolution and Code generation with the Arrow Meta Compiler DSL arrow.meta.dsl.

Do you like Arrow?

Arrow Org