compiler-plugin / arrow.meta.quotes.element / CatchClause

CatchClause

class CatchClause : Scope<KtCatchClause>

”"”catch ($parameter) ${ catchBody }””“.catch

A template destructuring Scope for a KtCatchClause.

import arrow.meta.Meta
import arrow.meta.CliPlugin
import arrow.meta.invoke
import arrow.meta.quotes.Transform
import arrow.meta.quotes.catchClause

val Meta.reformatCatchClause: CliPlugin
 get() =
  "ReformatCatchClause" {
   meta(
    catchClause(this, { true }) { c ->
     Transform.replace(
      replacing = c,
      newDeclaration = """catch ($parameter) $`{ catchBody }`""".catch
     )
    }
   )
  }

Constructors

<init> ”"”catch ($parameter) ${ catchBody }””“.catchCatchClause(value: KtCatchClause?, parameter: Parameter = Parameter(value?.catchParameter), { catchBody }: Scope<KtExpression> = Scope(value?.catchBody))

Properties

parameter val parameter: Parameter
value val value: KtCatchClause?
{ catchBody } val { catchBody }: Scope<KtExpression>

Functions

identity fun ElementScope.identity(): CatchClause

Extension Functions

map fun <K : KtElement> Scope<K>.map(f: (K) -> K): Scope<K>
orEmpty fun <K : KtElement> Scope<K>?.orEmpty(): Scope<K>

Do you like Arrow?

Arrow Org
<