Skip to content

Commit ec2ca8b

Browse files
authored
Cleanup pure span handling (#76846)
That `add_pure_comment(dummy_pure_span)` shouldn't be necessary with `PURE_SP`.
1 parent 22812d4 commit ec2ca8b

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

crates/next-custom-transforms/src/transforms/server_actions.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -1855,8 +1855,6 @@ impl<C: Comments> VisitMut for ServerActions<C> {
18551855
for (ident, export_name, ref_id) in self.exported_idents.iter() {
18561856
if !self.config.is_react_server_layer {
18571857
if export_name == "default" {
1858-
self.comments.add_pure_comment(ident.span.lo);
1859-
18601858
let export_expr = ModuleItem::ModuleDecl(ModuleDecl::ExportDefaultExpr(
18611859
ExportDefaultExpr {
18621860
span: DUMMY_SP,
@@ -1868,6 +1866,7 @@ impl<C: Comments> VisitMut for ServerActions<C> {
18681866
span: if self.config.is_react_server_layer
18691867
|| self.config.is_development
18701868
{
1869+
self.comments.add_pure_comment(ident.span.lo);
18711870
ident.span
18721871
} else {
18731872
PURE_SP
@@ -1888,9 +1887,6 @@ impl<C: Comments> VisitMut for ServerActions<C> {
18881887
));
18891888
new.push(export_expr);
18901889
} else {
1891-
let dummy_pure_span = Span::dummy_with_cmt();
1892-
self.comments.add_pure_comment(dummy_pure_span.lo);
1893-
18941890
let export_expr =
18951891
ModuleItem::ModuleDecl(ModuleDecl::ExportDecl(ExportDecl {
18961892
span: DUMMY_SP,
@@ -1918,7 +1914,7 @@ impl<C: Comments> VisitMut for ServerActions<C> {
19181914
.into(),
19191915
),
19201916
init: Some(Box::new(Expr::Call(CallExpr {
1921-
span: dummy_pure_span,
1917+
span: PURE_SP,
19221918
callee: Callee::Expr(Box::new(Expr::Ident(
19231919
create_ref_ident.clone(),
19241920
))),

0 commit comments

Comments
 (0)