Skip to content

5.0.0

Latest
Compare
Choose a tag to compare
@AndrewRayCode AndrewRayCode released this 28 Jul 20:20
· 15 commits to main since this release
62017d8

PR that introduced this change

This introduces breaking changs to the utility API functions renameBindings, renameFunctions, and renameTypes and changes their signatures to take the specific scope index, rather than the full scope.

This also changes the signature of the mangle() function to no longer be passed the AST node in question to be mangled. @shaderfrog/core used this as a hack to set a property directly on AST nodes (.doNotDescope) to avoid other functions from touching it.

It also exports new individual utility functions renameBinding etc, and a helper debug function.

These changes are largely in service of @shaderfrog/core to support better AST manipulation by allowing for the renameFunctions to modify scope indices. This is to keep the scopes in sync with the manipulated AST, which allows for more utility functions to work on scope, and avoid re-visiting an AST to find variables after an AST manipulation.