File tree Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -116,18 +116,18 @@ impl VisitMut for TransformVisitor {
116116 if let Callee :: Expr ( expr) = & call_expr. callee {
117117 if let Expr :: Ident ( id) = & * * expr {
118118 if self . local_idents . contains ( & * id. sym ) {
119- // Initialize the variable name with prefix or empty
120- let mut variable_name = if self . plugin_config . display_name {
121- self . current_object_prop_declarator
122- . as_ref ( )
123- . or ( self . current_var_declarator . as_ref ( ) )
124- . map ( |name| format ! ( "{name}--" ) )
125- . unwrap_or_else ( String :: new )
126- } else {
127- String :: new ( )
128- } ;
129-
130- // Append hash and counter
119+ let mut variable_name = String :: new ( ) ;
120+
121+ if self . plugin_config . display_name {
122+ if let Some ( object_prop_declarator ) = & self . current_object_prop_declarator {
123+ write ! ( & mut variable_name , "{object_prop_declarator}--" ) . unwrap ( ) ;
124+ }
125+
126+ if let Some ( var_declarator ) = & self . current_var_declarator {
127+ write ! ( & mut variable_name , "{var_declarator}--" ) . unwrap ( ) ;
128+ }
129+ }
130+
131131 write ! (
132132 & mut variable_name,
133133 "{}{}" ,
@@ -258,7 +258,7 @@ mod tests {
258258 const primary = createVar("primary--hashed0");
259259 const theme = {
260260 colors: {
261- primary: createVar("primary--hashed1")
261+ primary: createVar("primary--colors-- hashed1")
262262 }
263263 };"#
264264 ) ;
You can’t perform that action at this time.
0 commit comments