Skip to content

Cleanup pure span handling #76846

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 6, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -1855,8 +1855,6 @@ impl<C: Comments> VisitMut for ServerActions<C> {
for (ident, export_name, ref_id) in self.exported_idents.iter() {
if !self.config.is_react_server_layer {
if export_name == "default" {
self.comments.add_pure_comment(ident.span.lo);

let export_expr = ModuleItem::ModuleDecl(ModuleDecl::ExportDefaultExpr(
ExportDefaultExpr {
span: DUMMY_SP,
Expand All @@ -1868,6 +1866,7 @@ impl<C: Comments> VisitMut for ServerActions<C> {
span: if self.config.is_react_server_layer
|| self.config.is_development
{
self.comments.add_pure_comment(ident.span.lo);
ident.span
} else {
PURE_SP
Expand All @@ -1888,9 +1887,6 @@ impl<C: Comments> VisitMut for ServerActions<C> {
));
new.push(export_expr);
} else {
let dummy_pure_span = Span::dummy_with_cmt();
self.comments.add_pure_comment(dummy_pure_span.lo);

let export_expr =
ModuleItem::ModuleDecl(ModuleDecl::ExportDecl(ExportDecl {
span: DUMMY_SP,
Expand Down Expand Up @@ -1918,7 +1914,7 @@ impl<C: Comments> VisitMut for ServerActions<C> {
.into(),
),
init: Some(Box::new(Expr::Call(CallExpr {
span: dummy_pure_span,
span: PURE_SP,
callee: Callee::Expr(Box::new(Expr::Ident(
create_ref_ident.clone(),
))),
Expand Down
Loading