pub fn hygiene_with_config(config: Config) -> impl 'static + Pass + VisitMut
Expand description
The pass actually modifies the identifiers in the way that different
identifier (with respect to span hygiene) becomes different identifier.
(e.g. a1
for a#6
, a2
for a#23
)
§Implementation details
This document exists For curious people and potential contributors.
hygiene
consists of three phases.
§First phase
At first phase, we mark (using [swc_common::Mark]) nodes which can be
considered as a scope
. e.g. [Function], [BlockStmt], [ArrowExpr]
§Second phase
At second phase, we analyzes the file and determine identifiers to rename.
Note that we store scoping information for each node, using the fact that
[SyntaxContext] of all scope
nodes are unique, thanks to the first phase.
§Third phase
At third phase, we rename all identifiers in the queue.