Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Fix: Include newlines at the end of source in AST (fixes #352) #353

Merged
merged 1 commit into from
Aug 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,7 @@ module.exports = function convert(config) {
}
});

// fix end location
result.range[1] = node.endOfFileToken.pos;
result.range[1] = node.endOfFileToken.end;
result.loc = nodeUtils.getLocFor(node.getStart(), result.range[1], ast);
break;

Expand Down
36 changes: 18 additions & 18 deletions tests/lib/__snapshots__/basics.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ Object {
],
"loc": Object {
"end": Object {
"column": 15,
"line": 1,
"column": 0,
"line": 2,
},
"start": Object {
"column": 0,
Expand All @@ -106,7 +106,7 @@ Object {
},
"range": Array [
0,
15,
16,
],
"sourceType": "script",
"tokens": Array [
Expand Down Expand Up @@ -501,8 +501,8 @@ Object {
],
"loc": Object {
"end": Object {
"column": 16,
"line": 6,
"column": 0,
"line": 7,
},
"start": Object {
"column": 0,
Expand All @@ -511,7 +511,7 @@ Object {
},
"range": Array [
0,
58,
59,
],
"sourceType": "script",
"tokens": Array [
Expand Down Expand Up @@ -1181,8 +1181,8 @@ Object {
],
"loc": Object {
"end": Object {
"column": 1,
"line": 9,
"column": 0,
"line": 10,
},
"start": Object {
"column": 0,
Expand All @@ -1191,7 +1191,7 @@ Object {
},
"range": Array [
0,
59,
60,
],
"sourceType": "script",
"tokens": Array [
Expand Down Expand Up @@ -1716,8 +1716,8 @@ Object {
],
"loc": Object {
"end": Object {
"column": 14,
"line": 1,
"column": 0,
"line": 2,
},
"start": Object {
"column": 0,
Expand All @@ -1726,7 +1726,7 @@ Object {
},
"range": Array [
0,
14,
15,
],
"sourceType": "script",
"tokens": Array [
Expand Down Expand Up @@ -2219,8 +2219,8 @@ Object {
],
"loc": Object {
"end": Object {
"column": 12,
"line": 1,
"column": 0,
"line": 2,
},
"start": Object {
"column": 0,
Expand All @@ -2229,7 +2229,7 @@ Object {
},
"range": Array [
0,
12,
13,
],
"sourceType": "script",
"tokens": Array [
Expand Down Expand Up @@ -2978,8 +2978,8 @@ Object {
],
"loc": Object {
"end": Object {
"column": 8,
"line": 2,
"column": 0,
"line": 3,
},
"start": Object {
"column": 0,
Expand All @@ -2988,7 +2988,7 @@ Object {
},
"range": Array [
0,
16,
17,
],
"sourceType": "script",
"tokens": Array [
Expand Down
Loading