[JS AST] Don't generate a new line after try and if-then blocks

This commit is contained in:
Zalim Bashorov
2019-11-20 18:07:01 +03:00
parent 8f9895e64e
commit 4e3a2a0b3e
@@ -653,6 +653,10 @@ public class JsToStringGenerationVisitor extends JsVisitor {
} }
nestedPush(thenStmt); nestedPush(thenStmt);
if (thenStmt instanceof JsBlock) {
lineBreakAfterBlock = false;
}
sourceLocationConsumer.pushSourceInfo(null); sourceLocationConsumer.pushSourceInfo(null);
accept(thenStmt); accept(thenStmt);
sourceLocationConsumer.popSourceInfo(); sourceLocationConsumer.popSourceInfo();
@@ -984,6 +988,7 @@ public class JsToStringGenerationVisitor extends JsVisitor {
public void visitTry(@NotNull JsTry x) { public void visitTry(@NotNull JsTry x) {
p.print(CHARS_TRY); p.print(CHARS_TRY);
spaceOpt(); spaceOpt();
lineBreakAfterBlock = false;
accept(x.getTryBlock()); accept(x.getTryBlock());
acceptList(x.getCatches()); acceptList(x.getCatches());