This function adds to the existing topdown callback, rather than replace it, by putting a callback in front of it to be tested first. The callback will be invoked when the traversal sees a call to a specific function.

add_topdown_callback(callbacks, fn, cb)

Arguments

callbacks

The existing callbacks.

fn

The function to which calls should be modified.

cb

The callback function to invoke.

Value

     The updated callbacks.

Details

The callback that is installed will be called with the usual callback arguments (which depend on context and user-provided information to ..., see rewrite_callbacks() and analysis_callbacks()), and additionally the next callback in line, through the parameter next_cb. This can be used to propagate information through several callbacks in a pipe-like fashion.