Skip to content

Commit d43c0ad

Browse files
committed
Add testcase
1 parent 254f1fd commit d43c0ad

File tree

1 file changed

+37
-44
lines changed

1 file changed

+37
-44
lines changed

libs/extractor/src/extractor/extract_style_from_styled.rs

Lines changed: 37 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -169,15 +169,14 @@ fn create_styled_component<'a>(
169169
SPAN,
170170
FormalParameterKind::ArrowFormalParameters,
171171
oxc_allocator::Vec::from_iter_in(
172-
vec![
173-
ast_builder.formal_parameter(
174-
SPAN,
175-
oxc_allocator::Vec::from_iter_in(vec![], ast_builder.allocator),
176-
ast_builder.binding_pattern(
177-
ast_builder.binding_pattern_kind_object_pattern(
178-
SPAN,
179-
oxc_allocator::Vec::from_iter_in(
180-
vec![
172+
vec![ast_builder.formal_parameter(
173+
SPAN,
174+
oxc_allocator::Vec::from_iter_in(vec![], ast_builder.allocator),
175+
ast_builder.binding_pattern(
176+
ast_builder.binding_pattern_kind_object_pattern(
177+
SPAN,
178+
oxc_allocator::Vec::from_iter_in(
179+
vec![
181180
ast_builder.binding_property(
182181
SPAN,
183182
ast_builder.property_key_static_identifier(SPAN, "style"),
@@ -215,28 +214,27 @@ fn create_styled_component<'a>(
215214
false,
216215
),
217216
],
218-
ast_builder.allocator,
219-
),
220-
Some(ast_builder.binding_rest_element(
221-
SPAN,
222-
ast_builder.binding_pattern(
223-
ast_builder.binding_pattern_kind_binding_identifier(
224-
SPAN,
225-
ast_builder.atom("rest"),
226-
),
227-
None::<oxc_allocator::Box<oxc_ast::ast::TSTypeAnnotation<'a>>>,
228-
false,
229-
),
230-
)),
217+
ast_builder.allocator,
231218
),
232-
None::<oxc_allocator::Box<oxc_ast::ast::TSTypeAnnotation<'a>>>,
233-
false,
219+
Some(ast_builder.binding_rest_element(
220+
SPAN,
221+
ast_builder.binding_pattern(
222+
ast_builder.binding_pattern_kind_binding_identifier(
223+
SPAN,
224+
ast_builder.atom("rest"),
225+
),
226+
None::<oxc_allocator::Box<oxc_ast::ast::TSTypeAnnotation<'a>>>,
227+
false,
228+
),
229+
)),
234230
),
235-
None,
236-
false,
231+
None::<oxc_allocator::Box<oxc_ast::ast::TSTypeAnnotation<'a>>>,
237232
false,
238233
),
239-
],
234+
None,
235+
false,
236+
false,
237+
)],
240238
ast_builder.allocator,
241239
),
242240
None::<oxc_allocator::Box<oxc_ast::ast::BindingRestElement<'a>>>,
@@ -245,20 +243,16 @@ fn create_styled_component<'a>(
245243
SPAN,
246244
oxc_allocator::Vec::from_iter_in(vec![], ast_builder.allocator),
247245
oxc_allocator::Vec::from_iter_in(
248-
vec![
249-
ast_builder.statement_expression(
246+
vec![ast_builder.statement_expression(
247+
SPAN,
248+
ast_builder.expression_jsx_element(
250249
SPAN,
251-
ast_builder.expression_jsx_element(
250+
ast_builder.alloc_jsx_opening_element(
252251
SPAN,
253-
ast_builder.alloc_jsx_opening_element(
254-
SPAN,
255-
ast_builder
256-
.jsx_element_name_identifier(SPAN, ast_builder.atom(tag_name)),
257-
None::<
258-
oxc_allocator::Box<oxc_ast::ast::TSTypeParameterInstantiation<'a>>,
259-
>,
260-
oxc_allocator::Vec::from_iter_in(
261-
vec![
252+
ast_builder.jsx_element_name_identifier(SPAN, ast_builder.atom(tag_name)),
253+
None::<oxc_allocator::Box<oxc_ast::ast::TSTypeParameterInstantiation<'a>>>,
254+
oxc_allocator::Vec::from_iter_in(
255+
vec![
262256
ast_builder.jsx_attribute_item_spread_attribute(
263257
SPAN,
264258
ast_builder
@@ -337,14 +331,13 @@ fn create_styled_component<'a>(
337331
),
338332
),
339333
],
340-
ast_builder.allocator,
341-
),
334+
ast_builder.allocator,
342335
),
343-
oxc_allocator::Vec::from_iter_in(vec![], ast_builder.allocator),
344-
None::<oxc_allocator::Box<oxc_ast::ast::JSXClosingElement<'a>>>,
345336
),
337+
oxc_allocator::Vec::from_iter_in(vec![], ast_builder.allocator),
338+
None::<oxc_allocator::Box<oxc_ast::ast::JSXClosingElement<'a>>>,
346339
),
347-
],
340+
)],
348341
ast_builder.allocator,
349342
),
350343
);

0 commit comments

Comments
 (0)