File tree Expand file tree Collapse file tree 6 files changed +65
-4
lines changed Expand file tree Collapse file tree 6 files changed +65
-4
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ impl Gen for Hashbang<'_> {
6868
6969impl Gen for Directive < ' _ > {
7070 fn r#gen ( & self , p : & mut Codegen , _ctx : Context ) {
71+ p. print_comments_at ( self . span . start ) ;
7172 p. add_source_mapping ( self . span ) ;
7273 p. print_indent ( ) ;
7374 // A Use Strict Directive may not contain an EscapeSequence or LineContinuation.
Original file line number Diff line number Diff line change @@ -224,6 +224,8 @@ pub mod legal {
224224* @preserve
225225*/
226226" ,
227+ // Issue #14953: legal comments above directives
228+ "/*!\n * legal comment\n */\n \n \" use strict\" ;\n \n export const foo = 'foo';" ,
227229 ]
228230 }
229231
Original file line number Diff line number Diff line change 11-- -
2- source : crates / oxc_codegen / tests / integration / main .rs
2+ source : crates / oxc_codegen / tests / integration / tester .rs
33-- -
44########## 0
55/* @license */
@@ -127,3 +127,19 @@ function foo() {
127127/**
128128* @preserve
129129*/
130+
131+ ########## 9
132+ /* !
133+ * legal comment
134+ */
135+
136+ " use strict" ;
137+
138+ export const foo = ' foo' ;
139+ ----------
140+ ' use strict' ;
141+ export const foo = ' foo' ;
142+
143+ /* !
144+ * legal comment
145+ */
Original file line number Diff line number Diff line change 11-- -
2- source : crates / oxc_codegen / tests / integration / main .rs
2+ source : crates / oxc_codegen / tests / integration / tester .rs
33-- -
44########## 0
55/* @license */
@@ -109,3 +109,17 @@ function foo(){(()=>{
109109/**
110110* @preserve
111111*/
112+
113+ ########## 9
114+ /* !
115+ * legal comment
116+ */
117+
118+ " use strict" ;
119+
120+ export const foo = ' foo' ;
121+ ----------
122+ ' use strict' ;export const foo= ` foo` ;
123+ /* !
124+ * legal comment
125+ */
Original file line number Diff line number Diff line change 11-- -
2- source : crates / oxc_codegen / tests / integration / main .rs
2+ source : crates / oxc_codegen / tests / integration / tester .rs
33-- -
44########## 0
55/* @license */
@@ -112,3 +112,18 @@ function foo() {
112112/**
113113* @preserve
114114*/
115+
116+ ########## 9
117+ /* !
118+ * legal comment
119+ */
120+
121+ " use strict" ;
122+
123+ export const foo = ' foo' ;
124+ ----------
125+ /* !
126+ * legal comment
127+ */
128+ ' use strict' ;
129+ export const foo = ' foo' ;
Original file line number Diff line number Diff line change 11-- -
2- source : crates / oxc_codegen / tests / integration / main .rs
2+ source : crates / oxc_codegen / tests / integration / tester .rs
33-- -
44########## 0
55/* @license */
@@ -108,3 +108,16 @@ function foo() {
108108*/
109109
110110/* ! For license information please see test.js */
111+ ########## 9
112+ /* !
113+ * legal comment
114+ */
115+
116+ " use strict" ;
117+
118+ export const foo = ' foo' ;
119+ ----------
120+ ' use strict' ;
121+ export const foo = ' foo' ;
122+
123+ /* ! For license information please see test.js */
You can’t perform that action at this time.
0 commit comments