Unverified Commit ec2ca8b6 authored by Niklas Mischkulnig's avatar Niklas Mischkulnig Committed by GitHub

Cleanup pure span handling (#76846)

That `add_pure_comment(dummy_pure_span)` shouldn't be necessary with `PURE_SP`.
parent 22812d49
...@@ -1855,8 +1855,6 @@ impl<C: Comments> VisitMut for ServerActions<C> { ...@@ -1855,8 +1855,6 @@ impl<C: Comments> VisitMut for ServerActions<C> {
for (ident, export_name, ref_id) in self.exported_idents.iter() { for (ident, export_name, ref_id) in self.exported_idents.iter() {
if !self.config.is_react_server_layer { if !self.config.is_react_server_layer {
if export_name == "default" { if export_name == "default" {
self.comments.add_pure_comment(ident.span.lo);
let export_expr = ModuleItem::ModuleDecl(ModuleDecl::ExportDefaultExpr( let export_expr = ModuleItem::ModuleDecl(ModuleDecl::ExportDefaultExpr(
ExportDefaultExpr { ExportDefaultExpr {
span: DUMMY_SP, span: DUMMY_SP,
...@@ -1868,6 +1866,7 @@ impl<C: Comments> VisitMut for ServerActions<C> { ...@@ -1868,6 +1866,7 @@ impl<C: Comments> VisitMut for ServerActions<C> {
span: if self.config.is_react_server_layer span: if self.config.is_react_server_layer
|| self.config.is_development || self.config.is_development
{ {
self.comments.add_pure_comment(ident.span.lo);
ident.span ident.span
} else { } else {
PURE_SP PURE_SP
...@@ -1888,9 +1887,6 @@ impl<C: Comments> VisitMut for ServerActions<C> { ...@@ -1888,9 +1887,6 @@ impl<C: Comments> VisitMut for ServerActions<C> {
)); ));
new.push(export_expr); new.push(export_expr);
} else { } else {
let dummy_pure_span = Span::dummy_with_cmt();
self.comments.add_pure_comment(dummy_pure_span.lo);
let export_expr = let export_expr =
ModuleItem::ModuleDecl(ModuleDecl::ExportDecl(ExportDecl { ModuleItem::ModuleDecl(ModuleDecl::ExportDecl(ExportDecl {
span: DUMMY_SP, span: DUMMY_SP,
...@@ -1918,7 +1914,7 @@ impl<C: Comments> VisitMut for ServerActions<C> { ...@@ -1918,7 +1914,7 @@ impl<C: Comments> VisitMut for ServerActions<C> {
.into(), .into(),
), ),
init: Some(Box::new(Expr::Call(CallExpr { init: Some(Box::new(Expr::Call(CallExpr {
span: dummy_pure_span, span: PURE_SP,
callee: Callee::Expr(Box::new(Expr::Ident( callee: Callee::Expr(Box::new(Expr::Ident(
create_ref_ident.clone(), create_ref_ident.clone(),
))), ))),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment