-
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: use proper location data for parenthesized class values (#159)
Fixes decaffeinate/decaffeinate#813 As with a few other cases, it's not actually safe to say that the range of a node is from the start of the leftmost child to the end of the rightmost child, since nodes can be wrapped in parens, so we call `mapBase` instead.
- Loading branch information
1 parent
5a9ec85
commit 4f5777b
Showing
3 changed files
with
106 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
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,2 @@ | ||
class A | ||
b: (c) |
102 changes: 102 additions & 0 deletions
102
test/examples/class-with-parenthesized-value/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,102 @@ | ||
{ | ||
"type": "Program", | ||
"line": 1, | ||
"column": 1, | ||
"range": [ | ||
0, | ||
17 | ||
], | ||
"raw": "class A\n b: (c)\n", | ||
"body": { | ||
"type": "Block", | ||
"line": 1, | ||
"column": 1, | ||
"range": [ | ||
0, | ||
16 | ||
], | ||
"statements": [ | ||
{ | ||
"type": "Class", | ||
"line": 1, | ||
"column": 1, | ||
"range": [ | ||
0, | ||
16 | ||
], | ||
"name": { | ||
"type": "Identifier", | ||
"line": 1, | ||
"column": 7, | ||
"raw": "A", | ||
"range": [ | ||
6, | ||
7 | ||
], | ||
"data": "A" | ||
}, | ||
"nameAssignee": { | ||
"type": "Identifier", | ||
"line": 1, | ||
"column": 7, | ||
"raw": "A", | ||
"range": [ | ||
6, | ||
7 | ||
], | ||
"data": "A" | ||
}, | ||
"body": { | ||
"type": "Block", | ||
"line": 2, | ||
"column": 3, | ||
"range": [ | ||
10, | ||
16 | ||
], | ||
"statements": [ | ||
{ | ||
"type": "ClassProtoAssignOp", | ||
"line": 2, | ||
"column": 3, | ||
"range": [ | ||
10, | ||
16 | ||
], | ||
"assignee": { | ||
"type": "Identifier", | ||
"line": 2, | ||
"column": 3, | ||
"raw": "b", | ||
"range": [ | ||
10, | ||
11 | ||
], | ||
"data": "b" | ||
}, | ||
"expression": { | ||
"type": "Identifier", | ||
"line": 2, | ||
"column": 7, | ||
"raw": "c", | ||
"range": [ | ||
14, | ||
15 | ||
], | ||
"data": "c" | ||
}, | ||
"raw": "b: (c)" | ||
} | ||
], | ||
"inline": false, | ||
"raw": "b: (c)" | ||
}, | ||
"boundMembers": [], | ||
"parent": null, | ||
"ctor": null, | ||
"raw": "class A\n b: (c)" | ||
} | ||
], | ||
"raw": "class A\n b: (c)" | ||
} | ||
} |