Regenerate AST after every modification to simplify multiple tree updates.
Add tests for registerTask method.