acorn-globals icon indicating copy to clipboard operation
acorn-globals copied to clipboard

Note AST mutation

Open forresto opened this issue 4 years ago • 1 comments

It should be noted in the Readme that acornGlobals(ast) will mutate ast, adding array of parents to Identifier nodes. These unexpected properties might trip folks that are walking the AST after running acornGlobals.

Alternatively, acornGlobals could deep clone the input, to avoid mutating it.

forresto avatar Apr 06 '21 09:04 forresto

We don't currently document the approach of passing in an AST node - we only document passing in a string. I would accept a PR to add documentation for the AST based approach to the README though (along with documenting the above caveat).

ForbesLindesay avatar Aug 31 '22 11:08 ForbesLindesay