Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxingbaoyu committed Oct 4, 2022
1 parent 232fab4 commit b058e3b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions packages/babel-generator/src/printer.ts
Expand Up @@ -823,8 +823,10 @@ class Printer {
const lastCommentLine = this._lastCommentLine;
if (startLine > 0 && lastCommentLine > 0) {
const offset = startLine - lastCommentLine;
this.newline(offset || 1);
return;
if (offset >= 0) {
this.newline(offset || 1);
return;
}
}

// don't add newlines at the beginning of the file
Expand Down
Expand Up @@ -9,7 +9,8 @@ function WithoutCurlyBraces() {
return foo.call(this);
}
console.log(_this, k); // => undefined
};for (var k in kv) {
};
for (var k in kv) {
_loop(k);
}
}
Expand All @@ -25,7 +26,8 @@ function WithCurlyBraces() {
return foo.call(this);
}
console.log(_this2, k); // => 777
};for (var k in kv) {
};
for (var k in kv) {
_loop2(k);
}
}
Expand Down

0 comments on commit b058e3b

Please sign in to comment.