Skip to content

Commit c833cfd

Browse files
committed
tweak
1 parent 5d6023e commit c833cfd

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/languages/ts.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,9 @@ export default (options = {}) => {
137137
/**
138138
* @param {Context} context
139139
* @param {{ line: number, column: number }} loc
140+
* @param {boolean} pad
140141
*/
141-
function flush_comments_until(context, loc) {
142+
function flush_comments_until(context, loc, pad) {
142143
while (comment_index < comments.length) {
143144
const comment = comments[comment_index];
144145

@@ -147,7 +148,7 @@ export default (options = {}) => {
147148

148149
if (comment.loc.end.line < loc.line) {
149150
context.newline();
150-
} else {
151+
} else if (pad) {
151152
context.write(' ');
152153
}
153154

@@ -528,7 +529,7 @@ export default (options = {}) => {
528529
const is_statement = /(Statement|Declaration)$/.test(node.type);
529530

530531
if (node.loc) {
531-
flush_comments_until(context, node.loc.start);
532+
flush_comments_until(context, node.loc.start, true);
532533
}
533534

534535
visit(node);

test/samples/large-file/expected.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3271,7 +3271,7 @@
32713271
},
32723272

32733273
// Keep pipe for back-compat
3274-
pipe(/* fnDone, fnFail, fnProgress */ ) {
3274+
pipe(/* fnDone, fnFail, fnProgress */) {
32753275
var fns = arguments;
32763276

32773277
return jQuery.Deferred(function (newDefer) {

test/samples/large-file/expected.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)