Factored out AST utility functions into new module.