maybeCallVisit

Helper to dispatch the node if the method exist otherwise to a fallback.

This implementation with a fallback enables grouping of nodes. The user can either choose to implement a visit method for the specific node or a visit that receive the more generic node.

Example with a callback:

static void fallback(T)(ref Self s, ref Vis v, T node) {}
maybeCallVisit(this, visitor, node, &fallback!SpecNode);
void
maybeCallVisit
(
SelfT
VisitorT
NodeT
FallbackT
)
(
ref SelfT self
,
ref VisitorT visitor
,
ref NodeT node
,
FallbackT fallback = null
)

Parameters

self SelfT

parent visitor that contains visitor

visitor VisitorT

the specialized visitor that contain the user impl visit func

node NodeT

the node to act upon

fallback FallbackT

visitor do not have an overload taking (node, self).

Meta