The idea behind DocMiniTransformations is to fuse transformations to the
doc AST, much like MiniPhaseTransform
in dotty core - but in a much more
simple implementation
The idea behind DocMiniTransformations is to fuse transformations to the
doc AST, much like MiniPhaseTransform
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.