fix(emit): regression - keep comments in emit (#23815)

Closes https://github.com/denoland/deno/discussions/23814
This commit is contained in:
David Sherret 2024-05-14 18:01:31 -04:00 committed by GitHub
parent dda8979cb1
commit 4ddc85e1da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 35 additions and 4 deletions

View File

@ -194,7 +194,7 @@ pub fn ts_config_to_transpile_and_emit_options(
},
deno_ast::EmitOptions {
inline_sources: options.inline_sources,
keep_comments: false,
keep_comments: true,
source_map,
source_map_file: None,
},

View File

@ -0,0 +1,4 @@
{
"args": "run main.ts",
"output": "main.out"
}

View File

@ -0,0 +1,4 @@
function test() {
// this comment should be in output
return 1 + 1;
}

View File

@ -0,0 +1,7 @@
function test() {
// this comment should be in output
return 1 + 1;
}
// should include the comments because people rely on this behavior
console.log(test.toString());

View File

@ -11,6 +11,11 @@ FNF:4
FNH:2
BRF:0
BRH:0
DA:1,1
DA:13,1
DA:14,1
DA:15,1
DA:16,1
DA:17,2
DA:18,2
DA:19,2
@ -21,6 +26,9 @@ DA:24,2
DA:25,2
DA:26,2
DA:27,2
DA:29,1
DA:30,1
DA:31,1
DA:32,1
DA:33,1
DA:34,1
@ -30,6 +38,8 @@ DA:38,2
DA:39,2
DA:40,2
DA:42,2
DA:44,1
DA:45,1
DA:46,0
DA:47,0
DA:48,0
@ -39,13 +49,19 @@ DA:52,0
DA:53,0
DA:54,0
DA:56,0
DA:58,1
DA:59,1
DA:60,1
DA:62,1
DA:63,1
DA:64,0
DA:65,0
DA:66,0
DA:68,0
DA:70,1
DA:71,0
DA:73,1
DA:74,1
LH:21
LF:35
LH:37
LF:51
end_of_record

View File

@ -1,4 +1,4 @@
cover [WILDCARD]/coverage/complex.ts ... 60.000% (21/35)
cover [WILDCARD]/coverage/complex.ts ... 72.549% (37/51)
46 | export function unused(
47 | foo: string,
48 | bar: string,