Dotty Documentation

0.6.0-bin-SNAPSHOT

object transform
extends Object

[-] Constructors

[-] Members

[+] trait DocMiniPhase

The idea behind DocMiniTransformations is to fuse transformations to the doc AST, much like MiniPhase in dotty core - but in a much more simple implementation

Usage

Create a DocMiniPhase which overrides the relevant method:

override def transformDef(implicit ctx: Context) = {
 case x if shouldTransform(x) => x.copy(newValue = ...)
}

On each node in the AST, the appropriate method in DocMiniPhase will be called in the order that they are supplied in DocMiniphaseTransformations.

There won't be a match-error as transformX is composed with an identity function.

The transformations in DocMiniTransformations will apply transformations to all nodes - this means that you do not need to transform children in transformPackage, because transformX will be called for the relevant children. If you want to add children to Package you need to do that in transformPackage, these additions will be persisted.

Deleting nodes in the AST

To delete a node in the AST, simply return NonEntity from transforming method