compiler-plugin / arrow.meta.quotes.expression / TryExpression

TryExpression

class TryExpression : Scope<KtTryExpression>

”"”try $tryBlock$catchClauses$finallySection”””.try

A template destructuring Scope for a KtTryExpression.

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

val Meta.reformatTry: CliPlugin
   get() =
     "Reformat Try Expression" {
       meta(
         tryExpression(this, { true }) { expression ->
           Transform.replace(
           replacing = expression,
           newDeclaration = """try $tryBlock$catchClauses$finallySection""".`try`
         )
       }
     )
   }

Constructors

<init> ”"”try $tryBlock$catchClauses$finallySection”””.tryTryExpression(value: KtTryExpression?, tryBlock: BlockExpression = BlockExpression(value?.tryBlock), catchClauses: ScopedList<KtCatchClause> = ScopedList(value = value?.catchClauses.orEmpty()), finallySection: FinallySection = FinallySection(value?.finallyBlock))

Properties

catchClauses val catchClauses: ScopedList<KtCatchClause>
finallySection val finallySection: FinallySection
tryBlock val tryBlock: BlockExpression
value val value: KtTryExpression?

Functions

identity fun ElementScope.identity(): TryExpression

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
<