-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle missing case in CS node location fixing (#271)
Fixes decaffeinate/decaffeinate#1177 In some cases, we need to extend the bounds of a function to include its terminating semicolon, and propagate that extension up the AST. In the new test case, there was a Value with no properties that wasn't having its bounds extended properly, which confused decaffeinate later. This fix broke another case due to heregex flags not being properly positioned, so detect heregex flag literals and fix their location as well.
- Loading branch information
1 parent
ffb5740
commit 2e667c3
Showing
3 changed files
with
135 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
test/examples/nested-object-with-inner-semicolon/input.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
a: | ||
b: -> | ||
c; |
103 changes: 103 additions & 0 deletions
103
test/examples/nested-object-with-inner-semicolon/output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
{ | ||
"body": { | ||
"column": 1, | ||
"end": 17, | ||
"inline": false, | ||
"line": 1, | ||
"raw": "a:\n b: ->\n c;", | ||
"start": 0, | ||
"statements": [ | ||
{ | ||
"column": 1, | ||
"end": 17, | ||
"line": 1, | ||
"members": [ | ||
{ | ||
"column": 1, | ||
"end": 17, | ||
"expression": { | ||
"column": 3, | ||
"end": 17, | ||
"line": 2, | ||
"members": [ | ||
{ | ||
"column": 3, | ||
"end": 17, | ||
"expression": { | ||
"body": { | ||
"column": 5, | ||
"end": 17, | ||
"inline": false, | ||
"line": 3, | ||
"raw": "c;", | ||
"start": 15, | ||
"statements": [ | ||
{ | ||
"column": 5, | ||
"data": "c", | ||
"end": 16, | ||
"line": 3, | ||
"raw": "c", | ||
"start": 15, | ||
"type": "Identifier" | ||
} | ||
], | ||
"type": "Block" | ||
}, | ||
"column": 6, | ||
"end": 17, | ||
"line": 2, | ||
"parameters": [ | ||
], | ||
"raw": "->\n c;", | ||
"start": 8, | ||
"type": "Function" | ||
}, | ||
"key": { | ||
"column": 3, | ||
"data": "b", | ||
"end": 6, | ||
"line": 2, | ||
"raw": "b", | ||
"start": 5, | ||
"type": "Identifier" | ||
}, | ||
"line": 2, | ||
"raw": "b: ->\n c;", | ||
"start": 5, | ||
"type": "ObjectInitialiserMember" | ||
} | ||
], | ||
"raw": "b: ->\n c;", | ||
"start": 5, | ||
"type": "ObjectInitialiser" | ||
}, | ||
"key": { | ||
"column": 1, | ||
"data": "a", | ||
"end": 1, | ||
"line": 1, | ||
"raw": "a", | ||
"start": 0, | ||
"type": "Identifier" | ||
}, | ||
"line": 1, | ||
"raw": "a:\n b: ->\n c;", | ||
"start": 0, | ||
"type": "ObjectInitialiserMember" | ||
} | ||
], | ||
"raw": "a:\n b: ->\n c;", | ||
"start": 0, | ||
"type": "ObjectInitialiser" | ||
} | ||
], | ||
"type": "Block" | ||
}, | ||
"column": 1, | ||
"end": 18, | ||
"line": 1, | ||
"raw": "a:\n b: ->\n c;\n", | ||
"start": 0, | ||
"type": "Program" | ||
} |