Skip to content

Commit

Permalink
Fix: include optional number after break statements
Browse files Browse the repository at this point in the history
  • Loading branch information
nikulis committed Jan 19, 2018
1 parent 8e23d30 commit 7ee8034
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/printer.js
Expand Up @@ -963,6 +963,9 @@ function printNode(path, options, print) {
indent(concat([line, path.call(print, "body")]))
]);
case "break":
if (node.level) {
return concat(["break ", path.call(print, "level")]);
}
return "break";
case "return":
if (node.expr) {
Expand Down
10 changes: 5 additions & 5 deletions tests/break/__snapshots__/jsfmt.spec.js.snap
Expand Up @@ -27,15 +27,15 @@ for ($i = 0;$i < 10;$i++) {
for ($i = 0;$i < 10;$i++) {
for ($j = 0;$j < 10;$j++) {
break;
break 2;
}
}
while (true) {
break;
break;
break;
break;
break;
break 1;
break (1);
break 2;
break (2);
}
`;

0 comments on commit 7ee8034

Please sign in to comment.