compiler-plugin / arrow.meta.quotes.classorobject / ObjectDeclaration

ObjectDeclaration

class ObjectDeclaration : ClassOrObjectScope<KtObjectDeclaration>

””” object $name { $body }””“.objectDeclaration

A template destructuring Scope for a KtObjectDeclaration.

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

val Meta.reformatObjectDeclaration: CliPlugin
   get() =
     "ReformatObjectDeclaration" {
       meta(
         objectDeclaration(this, { isObjectLiteral() }) { c ->
           Transform.replace(
             replacing = c,
             newDeclaration = """
                 | $`@annotations` object $name $superTypes {
                 |   $body
                 | }
                 | """.`object`
             )
           }
         )
       }

Constructors

<init> ””” object $name { $body }””“.objectDeclarationObjectDeclaration(value: KtObjectDeclaration)

Properties

value val value: KtObjectDeclaration

Functions

identity fun ElementScope.identity(): ObjectDeclaration

Extension Properties

allConstructors val <T : KtClassOrObject> ClassOrObjectScope<T>.allConstructors: <ERROR CLASS>

Extension Functions

getOrCreateBody fun <T : KtClassOrObject> ClassOrObjectScope<T>.getOrCreateBody(): Scope<KtClassBody>
map fun <K : KtElement> Scope<K>.map(f: (K) -> K): Scope<K>
orEmpty fun <K : KtElement> Scope<K>?.orEmpty(): Scope<K>
refinementExpression fun ObjectDeclaration.refinementExpression(): String?

Do you like Arrow?

Arrow Org
<