swc
swc copied to clipboard
Provide AST count information without a separate visitor pass
Describe the feature
When implementing a library that builds on top of SWC, we need to generate intermediary representations. This probably includes HashMaps or Vecs, which can benefit from a performance increase when initialized with the right capacity.
SWC should provide at least the following counts:
- node count (a count for all AST nodes)
- definition count (a count for all definitions, like functions and classes)
- export count (a count for all export specifiers)
Babel plugin or link to the feature description
No response
Additional context
This should not be implemented as a separate pass because it would be wasteful. This should be implemented at the parser level and I'm willing to contribute this.