This clones the given ast prior to working on it to avoid mutating the AST given to `transformFromAST`.