Skip to content

Commit

Permalink
Updagte
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Jul 18, 2024
1 parent 1e75293 commit 0b19c48
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions packages/emotion/transform/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ use swc_atoms::JsWord;
use swc_common::{comments::Comments, util::take::Take, BytePos, SourceMapperDyn, DUMMY_SP};
use swc_ecma_ast::{
ArrayLit, CallExpr, Callee, ClassDecl, ClassMethod, ClassProp, Expr, ExprOrSpread, FnDecl, Id,
Ident, ImportDecl, ImportSpecifier, JSXAttr, JSXAttrName, JSXAttrOrSpread, JSXAttrValue,
JSXElement, JSXElementName, JSXExpr, JSXExprContainer, JSXObject, KeyValueProp, MemberProp,
MethodProp, ModuleExportName, ObjectLit, Pat, Prop, PropName, PropOrSpread, SourceMapperExt,
SpreadElement, Tpl, VarDeclarator,
Ident, IdentName, ImportDecl, ImportSpecifier, JSXAttr, JSXAttrName, JSXAttrOrSpread,
JSXAttrValue, JSXElement, JSXElementName, JSXExpr, JSXExprContainer, JSXObject, KeyValueProp,
MemberProp, MethodProp, ModuleExportName, ObjectLit, Pat, Prop, PropName, PropOrSpread,
SourceMapperExt, SpreadElement, Tpl, VarDeclarator,
};
use swc_ecma_utils::ExprFactory;
use swc_ecma_visit::{Fold, FoldWith};
Expand Down Expand Up @@ -350,7 +350,7 @@ impl<C: Comments> EmotionTransformer<C> {
);
self.emotion_target_class_name_count += 1;
PropOrSpread::Prop(Box::new(Prop::KeyValue(KeyValueProp {
key: PropName::Ident(Ident::new(key.into(), DUMMY_SP)),
key: PropName::Ident(IdentName::new(key.into(), DUMMY_SP)),
value: stable_class_name.into(),
})))
}
Expand Down Expand Up @@ -494,7 +494,7 @@ impl<C: Comments> Fold for EmotionTransformer<C> {
if self.options.auto_label.unwrap_or(false) {
args_props.push(PropOrSpread::Prop(Box::new(
Prop::KeyValue(KeyValueProp {
key: PropName::Ident(Ident::new(
key: PropName::Ident(IdentName::new(
"label".into(),
DUMMY_SP,
)),
Expand Down Expand Up @@ -563,7 +563,7 @@ impl<C: Comments> Fold for EmotionTransformer<C> {
if self.options.auto_label.unwrap_or(false) {
args_props.push(PropOrSpread::Prop(Box::new(
Prop::KeyValue(KeyValueProp {
key: PropName::Ident(Ident::new(
key: PropName::Ident(IdentName::new(
"label".into(),
DUMMY_SP,
)),
Expand All @@ -585,14 +585,14 @@ impl<C: Comments> Fold for EmotionTransformer<C> {
}
return CallExpr {
span: expr.span,
type_args: expr.type_args,
args: expr.args,
callee: CallExpr {
span: DUMMY_SP,
type_args: None,
callee: Ident::new(i.sym.clone(), i.span)
callee: Ident::new(i.sym.clone(), i.span, i.ctxt)
.as_callee(),
args,
..Default::default()
}
.as_callee(),
};
Expand Down
6 changes: 3 additions & 3 deletions packages/styled-components/transform/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub(crate) fn get_prop_key_as_expr(p: &Prop) -> Cow<Expr> {

pub(crate) fn prop_name_to_expr(p: &PropName) -> Cow<Expr> {
match p {
PropName::Ident(p) => Cow::Owned(Expr::Ident(p.clone())),
PropName::Ident(p) => Cow::Owned(Expr::Ident(p.clone().into())),
PropName::Str(p) => Cow::Owned(Expr::Lit(Lit::Str(p.clone()))),
PropName::Num(p) => Cow::Owned(Expr::Lit(Lit::Num(p.clone()))),
PropName::BigInt(p) => Cow::Owned(Expr::Lit(Lit::BigInt(p.clone()))),
Expand All @@ -42,9 +42,9 @@ pub(crate) fn get_prop_name(p: &Prop) -> Option<&PropName> {

pub(crate) fn get_prop_name2(p: &Prop) -> PropName {
match p {
Prop::Shorthand(ident) => PropName::Ident(ident.clone()),
Prop::Shorthand(ident) => PropName::Ident(ident.clone().into()),
Prop::KeyValue(p) => p.key.clone(),
Prop::Assign(x) => PropName::Ident(x.key.clone()),
Prop::Assign(x) => PropName::Ident(x.key.clone().into()),
Prop::Getter(p) => p.key.clone(),
Prop::Setter(p) => p.key.clone(),
Prop::Method(p) => p.key.clone(),
Expand Down

0 comments on commit 0b19c48

Please sign in to comment.