Fast path for newline processing.
This commit is contained in:
parent
e7796b45c9
commit
dc92a16e7f
@ -211,10 +211,20 @@ export default class Printer extends Buffer {
|
||||
}
|
||||
|
||||
_printNewline(leading, node, parent, opts) {
|
||||
// Fast path since 'this.newline' does nothing when not tracking lines.
|
||||
if (this.format.retainLines || this.format.compact) return;
|
||||
|
||||
if (!opts.statement && !n.isUserWhitespacable(node, parent)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Fast path for concise since 'this.newline' just inserts a space when
|
||||
// concise formatting is in use.
|
||||
if (this.format.concise) {
|
||||
this.space();
|
||||
return;
|
||||
}
|
||||
|
||||
let lines = 0;
|
||||
|
||||
if (node.start != null && !node._ignoreUserWhitespace && this.tokens.length) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user