Fix a pair of superficial issues in generated JS

1. Catch bodies were unconditionally wrapped in a block, even when
they were already a block.

2. Finally was on a line by itself and indented incorrectly because of
an extra newline.

Bug:
Change-Id: I006cd2841c159a0fc86501bfaf282c7ad4c0ab0b
Reviewed-on: https://dart-review.googlesource.com/23580
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
This commit is contained in:
Kevin Millikin 2017-11-24 15:31:27 +00:00 committed by commit-bot@chromium.org
parent f84f656d56
commit 4f551306f5
2 changed files with 2 additions and 2 deletions

View file

@ -500,7 +500,7 @@ class Printer extends TypeScriptTypePrinter implements NodeVisitor {
visitNestedExpression(node.declaration, EXPRESSION,
newInForInit: false, newAtStatementBegin: false);
out(")");
blockBody(node.body, needsSeparation: false, needsNewline: true);
blockBody(node.body, needsSeparation: false, needsNewline: false);
}
visitSwitch(Switch node) {

View file

@ -3304,7 +3304,7 @@ class ProgramCompiler
var catchVarDecl = _emitVariableRef(_catchParameter);
_catchParameter = savedCatch;
return new JS.Catch(catchVarDecl, new JS.Block([catchBody]));
return new JS.Catch(catchVarDecl, catchBody.toBlock());
}
JS.Statement _catchClauseGuard(Catch node, JS.Statement otherwise) {