Skip to content

Commit d10b125

Browse files
committed
feature: @putout/printer: ForStatement inside LabeledStatement: indent
1 parent 1507118 commit d10b125

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

lib/tokenize/statements/for-statement.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22

3+
const {isInsideLabel} = require('#is');
34
const {exists} = require('../is');
45

56
const {markAfter} = require('../mark');
@@ -12,7 +13,7 @@ module.exports.ForStatement = {
1213
body,
1314
} = path.node;
1415

15-
indent();
16+
maybe.indent(!isInsideLabel(path));
1617
print('for');
1718
print.space();
1819
print('(');
@@ -45,3 +46,4 @@ module.exports.ForStatement = {
4546
markAfter(path);
4647
},
4748
};
49+
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
{
22
a: b: console.log();
3-
}
3+
}
4+
outer: for (let i = 0; i < 2; i++) {
5+
inner: for (let j = 0; j < 2; j++) {
6+
if (i + j > 2)
7+
break outer;
8+
9+
continue inner;
10+
}
11+
}

0 commit comments

Comments
 (0)