While trying to get QASTNode.nqp to compile I noticed a strange error claiming that some code refs where missing from the serialization context.
The approach I have taken is to parse the code once, and pass the AST to two different backendshttps://github.com/pmurias/rakudo-js/blob/master/bin/compile-setting.nqp .
The problem with that is both of the backends serialize the serialization contexts.
And the context serialization code marks attaches some info onto closures.
It really makes sense to serialize the compilation context once (as it's assumed to be immutable after serialization).
So I set to introduce some caching.
First I tried to but the caching inside QAST::CompUnithttps://github.com/perl6/nqp/commits/cached-serialization. Jonathan however felt that I was puting stuff into nodes which shouldn't concern them.
So I planned a redesign of the serialization opcodes to implement it more elegantly. Seeing that Jonathan explained that instead of pushing the changes deeper and deeper I should hack this on without tangling it up with the rest of the code.
For now I'm using a branch, but it seems to be possible to easily monkey patch the compiler to introduce a contextual.
To shake out bugs and find things to test I started writing some unit tests for bits of qast https://github.com/pmurias/rakudo-js/blob/master/t/qast-node.t