mirror of
https://github.com/swc-project/swc.git
synced 2024-12-24 22:22:34 +03:00
fix(es/codegen): Fix sourcemap of comments (#3723)
This commit is contained in:
parent
2ab88b5556
commit
b8b0c920e4
@ -1,5 +1,5 @@
|
||||
{
|
||||
"mappings": "AAAAA,CAAC,EAAG,CAA6B,AAA7B,EAA6B,AAA7B,yBAA6B,AAA7B,EAA6B",
|
||||
"mappings": "AAAAA,CAAC,GAAG,EAA6B,AAA7B,yBAA6B,AAA7B,EAA6B",
|
||||
"names": [
|
||||
"a"
|
||||
],
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"mappings": "AAAAA,CAAC,EAAG,CAA6B,AAA7B,EAA6B,AAA7B,yBAA6B,AAA7B,EAA6B",
|
||||
"mappings": "AAAAA,CAAC,GAAG,EAA6B,AAA7B,yBAA6B,AAA7B,EAA6B",
|
||||
"names": [
|
||||
"a"
|
||||
],
|
||||
|
11
crates/swc/tests/fixture/issue-3716/input/.swcrc
Normal file
11
crates/swc/tests/fixture/issue-3716/input/.swcrc
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"jsc": {
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
"tsx": false,
|
||||
"decorators": false,
|
||||
"dynamicImport": false
|
||||
}
|
||||
},
|
||||
"sourceMaps": true
|
||||
}
|
7
crates/swc/tests/fixture/issue-3716/input/index.js
Normal file
7
crates/swc/tests/fixture/issue-3716/input/index.js
Normal file
@ -0,0 +1,7 @@
|
||||
a()/*?*/
|
||||
|
||||
a()//?
|
||||
|
||||
a();/*?*/
|
||||
|
||||
a();//?
|
5
crates/swc/tests/fixture/issue-3716/output/index.js
Normal file
5
crates/swc/tests/fixture/issue-3716/output/index.js
Normal file
@ -0,0 +1,5 @@
|
||||
a();
|
||||
/*?*/ a() //?
|
||||
;
|
||||
a(); /*?*/
|
||||
a(); //?
|
13
crates/swc/tests/fixture/issue-3716/output/index.map
Normal file
13
crates/swc/tests/fixture/issue-3716/output/index.map
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"mappings": "AAAAA,CAAC;AAAE,EAAK,AAAL,CAAK,AAAL,EAAK,CAERA,CAAC,GAAE,EAAG,AAAH,CAAG;;AAENA,CAAC,IAAG,EAAK,AAAL,CAAK,AAAL,EAAK;AAETA,CAAC,IAAG,EAAG,AAAH,CAAG",
|
||||
"names": [
|
||||
"a"
|
||||
],
|
||||
"sources": [
|
||||
"../../input/index.js"
|
||||
],
|
||||
"sourcesContent": [
|
||||
"a()/*?*/\n\na()//?\n\na();/*?*/\n\na();//?\n"
|
||||
],
|
||||
"version": 3
|
||||
}
|
@ -13,7 +13,7 @@ macro_rules! write_comments {
|
||||
match cmt.kind {
|
||||
CommentKind::Line => {
|
||||
if $prefix_space {
|
||||
$e.wr.write_comment(cmt.span, " ")?;
|
||||
$e.wr.write_comment(swc_common::DUMMY_SP, " ")?;
|
||||
}
|
||||
$e.wr.write_comment(cmt.span, "//")?;
|
||||
$e.wr.write_comment(cmt.span, &cmt.text)?;
|
||||
@ -21,7 +21,7 @@ macro_rules! write_comments {
|
||||
}
|
||||
CommentKind::Block => {
|
||||
if $prefix_space {
|
||||
$e.wr.write_comment(cmt.span, " ")?;
|
||||
$e.wr.write_comment(swc_common::DUMMY_SP, " ")?;
|
||||
}
|
||||
$e.wr.write_comment(cmt.span, "/*")?;
|
||||
$e.wr.write_lit(cmt.span, &cmt.text)?;
|
||||
|
Loading…
Reference in New Issue
Block a user