diff options
Diffstat (limited to 'src/ir/manipulation.h')
-rw-r--r-- | src/ir/manipulation.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/ir/manipulation.h b/src/ir/manipulation.h index 64cd15dc3..e7816af9f 100644 --- a/src/ir/manipulation.h +++ b/src/ir/manipulation.h @@ -68,6 +68,17 @@ inline OutputType* convert(InputType* input, MixedArena& allocator) { // expression before copying it. If it returns a non-null value then that is // used (effectively overriding the normal copy), and if it is null then we do a // normal copy. +// +// The order of iteration here is *pre*-order, that is, parents before children, +// so that it is possible to override an expression and all its children. +// Children themselves are visited in normal order. For example, this is the +// order of the following expression: +// +// (i32.add ;; visited first (and children not visited, if overridden) +// (call $a) ;; visited second +// (call $b) ;; visited third +// ) +// using CustomCopier = std::function<Expression*(Expression*)>; Expression* flexibleCopy(Expression* original, Module& wasm, CustomCopier custom); |