File tree 3 files changed +26
-0
lines changed
crates/swc_ecma_codegen/src
3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ swc_ecma_codegen : patch
3
+ swc_core : patch
4
+ ---
5
+
6
+ fix(es/codegen): Emit space after div if rhs has leading comment
Original file line number Diff line number Diff line change @@ -1267,6 +1267,13 @@ where
1267
1267
let need_post_space = if self . cfg . minify {
1268
1268
if is_kwd_op {
1269
1269
node. right . starts_with_alpha_num ( )
1270
+ } else if node. op == op ! ( "/" ) {
1271
+ let span = node. right . span ( ) ;
1272
+
1273
+ span. is_pure ( )
1274
+ || self
1275
+ . comments
1276
+ . map_or ( false , |comments| comments. has_leading ( node. right . span ( ) . lo ) )
1270
1277
} else {
1271
1278
require_space_before_rhs ( & node. right , & node. op )
1272
1279
}
Original file line number Diff line number Diff line change @@ -962,6 +962,19 @@ fn issue_8491_2() {
962
962
) ;
963
963
}
964
964
965
+ #[ test]
966
+ fn issue_9630 ( ) {
967
+ test_from_to_custom_config (
968
+ "console.log(1 / /* @__PURE__ */ something())" ,
969
+ "console.log(1/ /* @__PURE__ */something())" ,
970
+ Config {
971
+ minify : true ,
972
+ ..Default :: default ( )
973
+ } ,
974
+ Default :: default ( ) ,
975
+ ) ;
976
+ }
977
+
965
978
#[ testing:: fixture( "tests/str-lits/**/*.txt" ) ]
966
979
fn test_str_lit ( input : PathBuf ) {
967
980
test_str_lit_inner ( input)
You can’t perform that action at this time.
0 commit comments