Skip to main content

stylex_transform/transform/stylex/
transform_stylex_attrs_call.rs

1use swc_core::{
2  common::comments::Comments,
3  ecma::ast::{CallExpr, Expr},
4};
5
6use crate::{
7  StyleXTransform,
8  shared::utils::{
9    core::{attrs::attrs, stylex_merge::stylex_merge},
10    validators::is_attrs_call,
11  },
12};
13
14impl<C> StyleXTransform<C>
15where
16  C: Comments,
17{
18  pub(crate) fn transform_stylex_attrs_call(&mut self, call: &mut CallExpr) -> Option<Expr> {
19    let is_attrs_call = is_attrs_call(call, &self.state);
20
21    if is_attrs_call {
22      return stylex_merge(call, attrs, &mut self.state);
23    }
24
25    None
26  }
27}