Skip to content

Commit b29ccb6

Browse files
authored
fix: properly handle loop then (#224)
1 parent cead22d commit b29ccb6

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

src/mappers/mapWhile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default function mapWhile(context: ParseContext, node: CoffeeWhile): Whil
1414
if (startToken && startToken.type === SourceType.LOOP) {
1515
return new Loop(
1616
line, column, start, end, raw,
17-
node.body ? mapAny(context, node.body) : null
17+
mapPossiblyEmptyBlock(context, node.body)
1818
);
1919
}
2020

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
loop then
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"body": {
3+
"column": 1,
4+
"inline": false,
5+
"line": 1,
6+
"range": [
7+
0,
8+
4
9+
],
10+
"raw": "loop",
11+
"statements": [
12+
{
13+
"body": null,
14+
"column": 1,
15+
"line": 1,
16+
"range": [
17+
0,
18+
4
19+
],
20+
"raw": "loop",
21+
"type": "Loop"
22+
}
23+
],
24+
"type": "Block"
25+
},
26+
"column": 1,
27+
"line": 1,
28+
"range": [
29+
0,
30+
10
31+
],
32+
"raw": "loop then\n",
33+
"type": "Program"
34+
}

0 commit comments

Comments
 (0)