compiler-plugin / arrow.meta.quotes.declaration / DestructuringDeclaration

DestructuringDeclaration

class DestructuringDeclaration : Scope<KtDestructuringDeclaration>

””“$valOrVar ($entries) = $initializer “”“.destructuringDeclaration

A template destructuring Scope for a KtDestructuringDeclaration.

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

val Meta.reformatDestructuringDeclaration: CliPlugin
   get() =
     "Reformat Destructuring Declaration" {
       meta(
         destructuringDeclaration(this, { true }) { declaration ->
           Transform.replace(
             replacing = declaration,
             newDeclaration = """$valOrVar ($entries) = $initializer """.destructuringDeclaration
           )
         }
       )
     }

Constructors

| <init> | “”“$valOrVar ($entries) = $initializer “”“.destructuringDeclarationDestructuringDeclaration(value: KtDestructuringDeclaration?, valOrVar: Name? = when { value?.isVar == true -> "var" value?.isVar != true -> "val" else -> "" }.let(Name::identifier), entries: ScopedList<KtDestructuringDeclarationEntry> = ScopedList(value?.entries.orEmpty()), initializer: Scope<KtExpression> = Scope(value?.initializer)) |

Properties

entries val entries: ScopedList<KtDestructuringDeclarationEntry>
initializer val initializer: Scope<KtExpression>
valOrVar val valOrVar: Name?
value val value: KtDestructuringDeclaration?

Functions

identity fun ElementScope.identity(): DestructuringDeclaration

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
<