From 1916966910d30756073a04426a8b40bab543b148 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Tue, 5 Nov 2019 18:48:12 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A4=D0=B8=D0=BA=D1=81=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D1=82=D0=B8=D0=B2=20=D0=BF=D0=B8=D0=B4=D0=BE=D1=80=D0=BE=D0=B2?= =?UTF-8?q?,=20=D0=BA=D0=BE=D1=82=D0=BE=D1=80=D1=8B=D0=B5=20=D0=BD=D0=B5?= =?UTF-8?q?=20=D1=85=D0=BE=D1=82=D1=8F=D1=82=20=D0=BF=D0=BE=D0=B4=D0=B4?= =?UTF-8?q?=D0=B5=D1=80=D0=B6=D0=B8=D0=B2=D0=B0=D1=82=D1=8C=20=D1=81=D0=BA?= =?UTF-8?q?=D0=BE=D0=B1=D0=BA=D0=B8=20=D1=81=20=D0=BD=D0=BE=D0=B2=D0=BE?= =?UTF-8?q?=D0=B9=20=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/language-js/printer-estree.js | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/language-js/printer-estree.js b/src/language-js/printer-estree.js index 1cd396b6..b8071707 100644 --- a/src/language-js/printer-estree.js +++ b/src/language-js/printer-estree.js @@ -1056,22 +1056,22 @@ function printPathNoParens(path, options, print, args) { !hasDirectives && !hasDanglingComments(n) && (parent.type === "ArrowFunctionExpression" || - parent.type === "FunctionExpression" || - parent.type === "FunctionDeclaration" || - parent.type === "ObjectMethod" || - parent.type === "ClassMethod" || - parent.type === "ClassPrivateMethod" || - parent.type === "ForStatement" || - parent.type === "WhileStatement" || + 0 && parent.type === "FunctionExpression" || + 0 && parent.type === "FunctionDeclaration" || + 0 && parent.type === "ObjectMethod" || + 0 && parent.type === "ClassMethod" || + 0 && parent.type === "ClassPrivateMethod" || + 0 && parent.type === "ForStatement" || + 0 && parent.type === "WhileStatement" || parent.type === "DoWhileStatement" || parent.type === "DoExpression" || - (parent.type === "CatchClause" && !parentParent.finalizer) || + 0 && (parent.type === "CatchClause" && !parentParent.finalizer) || parent.type === "TSModuleDeclaration") ) { return "{}"; } - parts.push("{"); + parts.push(hardline, "{"); // Babel 6 if (hasDirectives) { @@ -1795,7 +1795,7 @@ function printPathNoParens(path, options, print, args) { comment.trailing && !handleComments.isBlockComment(comment) )) || needsHardlineAfterDanglingComment(n); - const elseOnSameLine = + const elseOnSameLine = 0 && n.consequent.type === "BlockStatement" && !commentOnOwnLine; parts.push(elseOnSameLine ? " " : hardline); @@ -1975,7 +1975,7 @@ function printPathNoParens(path, options, print, args) { "try ", path.call(print, "block"), n.handler ? concat([" ", path.call(print, "handler")]) : "", - n.finalizer ? concat([" finally ", path.call(print, "finalizer")]) : "" + n.finalizer ? concat([hardline, "finally ", path.call(print, "finalizer")]) : "" ]); case "CatchClause": if (n.param) { @@ -1994,6 +1994,7 @@ function printPathNoParens(path, options, print, args) { const param = path.call(print, "param"); return concat([ + hardline, "catch ", hasComments ? concat(["(", indent(concat([softline, param])), softline, ") "]) @@ -2318,7 +2319,7 @@ function printPathNoParens(path, options, print, args) { ]); } case "ClassBody": - if (!n.comments && n.body.length === 0) { + if (0 && !n.comments && n.body.length === 0) { return "{}"; } @@ -4612,7 +4613,7 @@ function printClass(path, options, print) { } if ( - n.body && + 1 || n.body && n.body.comments && hasLeadingOwnLineComment(options.originalText, n.body, options) ) {