Perhaps. I think, though, this is going to have to support scoping once we add support for namespacing. Obviously the scope should not be part of the public API, but we're going to need an internal piece that returns it that's probably going to look a lot like this. Maybe we have something like this:

```js
/**
 * @param AST ast AST to transform
 * @returns AST ast transformed AST chunk
 * @returns Object.<string> errors Map of extracted errors
 */
function transform(ast) {
  var _transform = function (ast, extractedErrors, scope) {
    // _transform does the real work inside, and is aware of scope
    ...
    return {
      ast: newAST,
      errors: changedExtractedErrors,
      scope: changedScope
    };
  };
  var result = _transform(ast, {}, {});
  return {
    ast: result.ast,
    errors: result.errors
  };
}
```

Scope will be left out of the public API. We can either do exactly this or trivially modify it to return a new `extractedErrors`.