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

ImportDirective

class ImportDirective : Scope<KtImportDirective>

importDirective(ImportPath(importedFqName, isAllUnder, alias))

A template destructuring Scope for a KtImportDirective.

import arrow.meta.Meta
import arrow.meta.CliPlugin
import arrow.meta.invoke
import arrow.meta.quotes.Transform
import arrow.meta.quotes.importDirective
import org.jetbrains.kotlin.resolve.ImportPath

val Meta.reformatImportDirective: CliPlugin
 get() =
  "ReformatImportDirective" {
   meta(
    importDirective({ true }) { e ->
     Transform.replace(
      replacing = e,
      newDeclaration = importDirective(ImportPath(importedFqName, isAllUnder, alias))
     )
     }
    )
   }

Constructors

<init> importDirective(ImportPath(importedFqName, isAllUnder, alias))ImportDirective(value: KtImportDirective?, importedFqName: FqName = value?.importedFqName!!, isAllUnder: Boolean = value?.isAllUnder == true, alias: Name? = value?.aliasName?.let(Name::identifier))

Properties

alias val alias: Name?
importedFqName val importedFqName: FqName
isAllUnder val isAllUnder: Boolean
value val value: KtImportDirective?

Functions

identity fun ElementScope.identity(): ImportDirective

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
<