@@ -531,15 +531,13 @@ fn extract_style_from_member_expression<'a>(
531531) -> ExtractResult < ' a > {
532532 let mem_expression = & mem. expression . clone_in ( ast_builder. allocator ) ;
533533 let mut ret: Vec < ExtractStyleProp > = vec ! [ ] ;
534- println ! ( "어푸어푸 mem: {:?}" , mem) ;
535534
536535 match & mut mem. object {
537536 Expression :: ArrayExpression ( array) => {
538537 if array. elements . is_empty ( ) {
539538 return ExtractResult :: Remove ;
540539 }
541540
542- println ! ( "{:?}" , mem_expression) ;
543541 if let Some ( num) = get_number_by_literal_expression ( mem_expression) {
544542 if num < 0f64 {
545543 return ExtractResult :: Remove ;
@@ -583,7 +581,6 @@ fn extract_style_from_member_expression<'a>(
583581 } ;
584582 }
585583
586- println ! ( "flag1" ) ;
587584 let mut map = BTreeMap :: new ( ) ;
588585 for ( idx, p) in array. elements . iter_mut ( ) . enumerate ( ) {
589586 if let ArrayExpressionElement :: SpreadElement ( ref sp) = p {
@@ -618,51 +615,10 @@ fn extract_style_from_member_expression<'a>(
618615 }
619616 }
620617
621- println ! ( "flag2" ) ;
622618 ret. push ( ExtractStyleProp :: MemberExpression {
623619 expression : mem_expression. clone_in ( ast_builder. allocator ) ,
624620 map,
625621 } ) ;
626- println ! ( "flag3" ) ;
627-
628- // match mem_expression {
629- // Expression::NumericLiteral(v) => {
630- // if array.elements.len() < v.value as usize {
631- // // wrong indexing case
632- // ExtractResult::Remove
633- // } else {
634- // extract_style_from_expression(
635- // ast_builder,
636- // name,
637- // array.elements[v.value as usize]
638- // .clone_in(ast_builder.allocator)
639- // .to_expression_mut(),
640- // level,
641- // selector,
642- // )
643- // }
644- // }
645- // // wrong indexing case
646- // Expression::UnaryExpression(unary) => {
647- // if let Expression::NumericLiteral(_) = &unary.argument {
648- // ExtractResult::Remove
649- // } else {
650- // ExtractResult::Maintain
651- // }
652- // }
653- // _ => name
654- // .map(|name| {
655- // ExtractResult::ExtractStyle(vec![ExtractStyleProp::Static(Dynamic(
656- // ExtractDynamicStyle::new(
657- // name,
658- // level,
659- // expression_to_code(&mem.expression).as_str(),
660- // selector.map(|s| s.into()),
661- // ),
662- // ))])
663- // })
664- // .unwrap_or_else(|| ExtractResult::Maintain),
665- // };
666622 }
667623 Expression :: ObjectExpression ( obj) => {
668624 if obj. properties . is_empty ( ) {
@@ -739,77 +695,6 @@ fn extract_style_from_member_expression<'a>(
739695 expression : mem_expression. clone_in ( ast_builder. allocator ) ,
740696 map,
741697 } ) ;
742-
743- // for p in obj.properties.iter_mut() {
744- // if let ObjectPropertyKind::ObjectProperty(ref mut o) = p {
745- // if let PropertyKey::StaticIdentifier(_) = o.key {
746- // if let Expression::StringLiteral(str) = &mut o.value {
747- // if let Some(rest) = str.value.strip_prefix("$") {
748- // str.value = ast_builder.atom(&format!("var(--{})", rest));
749- // }
750- // } else if let Expression::TemplateLiteral(tmp) = &mut o.value {
751- // if tmp.quasis.len() == 1 {
752- // if let Some(rest) = tmp.quasis[0].value.raw.strip_prefix("$") {
753- // tmp.quasis[0].value.raw =
754- // ast_builder.atom(&format!("var(--{})", rest));
755- // }
756- // }
757- // }
758- // }
759- // }
760- // }
761- // match mem_expression {
762- // Expression::StringLiteral(str) => {
763- // let key = str.value.as_str();
764- // for p in obj.properties.iter() {
765- // match p {
766- // ObjectPropertyKind::ObjectProperty(o) => {
767- // if let PropertyKey::StaticIdentifier(ident) = &o.key {
768- // if ident.name == key {
769- // return extract_style_from_expression(
770- // ast_builder,
771- // name,
772- // &mut o.value.clone_in(ast_builder.allocator),
773- // level,
774- // selector,
775- // );
776- // }
777- // }
778- // }
779- // ObjectPropertyKind::SpreadProperty(_) => {
780- // if let Some(name) = name {
781- // return ExtractResult::ExtractStyle(vec![
782- // ExtractStyleProp::Static(Dynamic(
783- // ExtractDynamicStyle::new(
784- // name,
785- // level,
786- // expression_to_code(&mem.expression).as_str(),
787- // selector.map(|s| s.into()),
788- // ),
789- // )),
790- // ]);
791- // }
792- // }
793- // }
794- // }
795- // ExtractResult::Remove
796- // }
797- // Expression::Identifier(_) => {
798- // if let Some(name) = name {
799- // ExtractResult::ExtractStyle(vec![ExtractStyleProp::Static(Dynamic(
800- // ExtractDynamicStyle::new(
801- // name,
802- // level,
803- // expression_to_code(&mem.expression).as_str(),
804- // selector.map(|s| s.into()),
805- // ),
806- // ))])
807- // } else {
808- // ExtractResult::Maintain
809- // }
810- // }
811- // _ => ExtractResult::Maintain,
812- // }
813698 }
814699 Expression :: Identifier ( _) => {
815700 if let Some ( name) = name {
0 commit comments