Skip to main content

stylex_transform/transform/fold/
fold_ident.rs

1use swc_core::{common::comments::Comments, ecma::ast::Ident};
2
3use crate::{
4  StyleXTransform,
5  shared::utils::common::{increase_ident_count, reduce_ident_count},
6};
7use stylex_enums::core::TransformationCycle;
8
9impl<C> StyleXTransform<C>
10where
11  C: Comments,
12{
13  pub(crate) fn fold_ident_impl(&mut self, ident: Ident) -> Ident {
14    match self.state.cycle {
15      TransformationCycle::StateFilling => {
16        increase_ident_count(&mut self.state, &ident);
17      },
18      TransformationCycle::Recounting => {
19        reduce_ident_count(&mut self.state, &ident);
20      },
21      _ => {},
22    };
23
24    ident
25  }
26}