Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions crates/oxc_transformer/src/plugins/styled_components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -513,20 +513,14 @@ impl<'a> StyledComponents<'a, '_> {
}

fn get_with_config<'b>(expr: &'b mut Expression<'a>) -> Option<&'b mut CallExpression<'a>> {
let is_with_config = |call: &CallExpression<'a>| {
if let Expression::StaticMemberExpression(member) = &call.callee {
member.property.name == "withConfig"
} else {
false
}
};

let mut current = expr;
loop {
match current {
Expression::CallExpression(call) => {
if is_with_config(call) {
return Some(call);
if let Expression::StaticMemberExpression(member) = &call.callee {
if member.property.name == "withConfig" {
return Some(call);
}
}
current = &mut call.callee;
}
Expand Down
Loading