Following the discussion at http://groovy.329449.n5.nabble.com/InterruptibleScript-AST-Transform-tp3277076p3277076.html, this AST Transformation allows transparent script interruption when the worker thread is interrupted. It adds thread interruption checks on several points of code :
- different types of loops
- method first statement
The attached file is a preliminary implementation which does not propagate to the CompilationUnit yet (haven't found how to do it properly) + a simple script which I use for tests.
Feel free to review, patch,...