I managed to achieve this combination of two AST trees using the quote feature.
[https://github.com/mem-memov/mocknim/blob/15f1bd6f94d01a4b3d47b18c9c5b1a782c02a3cc/src/mocknim/templates/resultActionTemplate.nim#L39](https://github.com/mem-memov/mocknim/blob/15f1bd6f94d01a4b3d47b18c9c5b1a782c02a3cc/src/mocknim/templates/resultActionTemplate.nim#L39) The only thing I dislike is how the result variable of the surrounding function travels inside the quote block. But they say it has been already fixed last summer (for macros). [https://github.com/nim-lang/Nim/issues/7323#issuecomment-451684288](https://github.com/nim-lang/Nim/issues/7323#issuecomment-451684288) The activity of AST stitching resembles to me DOM manipulation in JS.
