Skip to content

Commit

Permalink
Redo one more
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Mar 18, 2022
1 parent ff9b679 commit afa1242
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions crates/swc_stylis/src/prefixer.rs
Expand Up @@ -215,6 +215,20 @@ impl Prefixer {
important: n.important.clone(),
});
}

fn same_name(&mut self, name: JsWord, n: &Declaration) {
let val = Ident {
span: DUMMY_SP,
value: name.clone(),
raw: name,
};
self.added_declarations.push(Declaration {
span: n.span,
name: n.name.clone(),
value: vec![ComponentValue::Ident(val)],
important: n.important.clone(),
});
}
}

pub enum Prefix {
Expand Down Expand Up @@ -466,17 +480,7 @@ impl VisitMut for Prefixer {

macro_rules! same_name {
($name:expr) => {{
let val = Ident {
span: DUMMY_SP,
value: $name.into(),
raw: $name.into(),
};
self.added_declarations.push(Declaration {
span: n.span,
name: n.name.clone(),
value: vec![ComponentValue::Ident(val)],
important: n.important.clone(),
});
self.same_name($name.into(), &n);
}};
}

Expand Down

0 comments on commit afa1242

Please sign in to comment.