Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RakuAST: Add potential infinite loop in BEGIN time call with nested b…
…locks Creating QAST for a block did not mean that we would generate QAST for nested blocks. The reason is that these blocks are not called directly, but instead their meta object gets closure cloned. Creating the meta object does not require immediate creation of the QAST. We just stub code objects instead. This means that if the outer block gets called at BEGIN time, the inner block may not have been linked yet to its QAST::Block. This in turn results in the clone not being registered in the original's clone list as they are linked via the CUID which comes from the QAST::Block. Since the clone is not known, calling the clone would have lead to dynamic compilation when its stub was called, but this compilation only set the $!do of the original code object, not the clone's. Thus when the stub then tried to forward the call to the actual code object, we'd end up in the stub again, hence in an infinite loop.
- Loading branch information