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

WhenEntry

class WhenEntry : Scope<KtWhenEntry>

(if (!isElse) “”“$conditions -> $expression””” else “"”else -> $expression”””).whenEntry

A template destructuring Scope for a KtWhenEntry.

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

val Meta.reformatWhenEntry: CliPlugin
 get() =
  "ReformatWhenEntry" {
   meta(
    whenEntry({ true }) { e ->
     Transform.replace(
      replacing = e,
      newDeclaration = (if (!isElse) """$conditions -> $expression""" else  """else -> $expression""").whenEntry
     )
    }
   )
  }

Constructors

| <init> | (if (!isElse) “”“$conditions -> $expression””” else “"”else -> $expression”””).whenEntryWhenEntry(value: KtWhenEntry?, conditions: ScopedList<KtWhenCondition> = ScopedList( separator = " && ", value = value?.conditions?.toList().orEmpty() ), expression: Scope<KtExpression> = Scope(value?.expression), isElse: Boolean = value?.isElse == true) |

Properties

conditions val conditions: ScopedList<KtWhenCondition>
expression val expression: Scope<KtExpression>
isElse val isElse: Boolean
value val value: KtWhenEntry?

Functions

identity fun ElementScope.identity(): WhenEntry

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
<