Avoid recalculating the current line.

This commit is contained in:
Logan Smyth 2016-07-16 23:12:20 -07:00
parent 1bbf109e8e
commit 59fe72ee7d

View File

@ -243,7 +243,9 @@ export default class Printer {
// catch up to this nodes newline if we're behind
const pos = loc ? loc[prop] : null;
if (pos && pos.line !== null) {
while (this._buf.getCurrentLine() < pos.line) {
const count = pos.line - this._buf.getCurrentLine();
for (let i = 0; i < count; i++) {
this._newline();
}
}