Callbacks have one required argument, expr
, but will actually be called
with more. The additional named parameters are:
identity_rewrite_callback(expr, ...) identity_analysis_callback(expr, bottomup, ...)
expr | The expression to (not) transform. |
---|---|
... | Additional named parameters. |
bottomup | Information gathered depth-first in analysis callbacks. This parameter is only passed to callbacks in analysis traversals and not rewrite traversals. |
expr
env The function environment of the function we are transforming
params The formal parameters of the function we are transforming
topdown Data passed top-down in the traversal.
bottomup Data collected by depth-first traversals before a callback is
called. plus whatever the user provide to depth_first_rewrite_function()
or
depth_first_analyse_function()
.
next_cb A handle to call the next callback if more are installed. This variable will be the callback that was in the callbacks list before this one replaced it.
In bottom up analyses, the merge_bottomup()
function can be used to
collected the results of several recursive calls. When annotating
expressions, the collect_from_args()
can be used in call
callbacks to
extract annotation information from call arguments.
identity_rewrite_callback
: Identity for expression rewriting
identity_analysis_callback
: Identity for expression rewriting
merge_bottomup
collect_from_args