Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions .changeset/spotty-geese-relate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
swc_ecma_transforms_react: patch
swc_core: patch
---

fix(es/transforms): Correct span for @jsxFrag as null literal
17 changes: 2 additions & 15 deletions crates/swc_ecma_transforms_react/src/jsx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,19 +289,6 @@ pub struct JsxDirectives {
pub pragma_frag: Option<Lrc<Box<Expr>>>,
}

fn respan(e: &mut Expr, span: Span) {
match e {
Expr::Ident(i) => {
i.span.lo = span.lo;
i.span.hi = span.hi;
}
Expr::Member(e) => {
e.span = span;
}
_ => {}
}
}

impl JsxDirectives {
pub fn from_comments(
cm: &SourceMap,
Expand Down Expand Up @@ -368,7 +355,7 @@ impl JsxDirectives {
cache_source(src),
top_level_mark,
);
respan(&mut e, cmt.span);
e.set_span(cmt.span);
res.pragma_frag = Some(e.into())
}
}
Expand All @@ -383,7 +370,7 @@ impl JsxDirectives {
cache_source(src),
top_level_mark,
);
respan(&mut e, cmt.span);
e.set_span(cmt.span);
res.pragma = Some(e.into());
}
}
Expand Down
Loading