diff --git a/src/plugins/flow.js b/src/plugins/flow.js index 3aa7323e3e..edfff21b9e 100644 --- a/src/plugins/flow.js +++ b/src/plugins/flow.js @@ -282,8 +282,11 @@ pp.flowParseObjectTypeIndexer = function (node, isStatic, variance) { node.value = this.flowParseTypeInitialiser(); node.variance = variance; + // Finish node first to not include a possible semicolon in the locations + const indexer = this.finishNode(node, "ObjectTypeIndexer"); this.flowObjectTypeSemicolon(); - return this.finishNode(node, "ObjectTypeIndexer"); + + return indexer; }; pp.flowParseObjectTypeMethodish = function (node) { diff --git a/test/fixtures/flow/interfaces-module-and-script/5/expected.json b/test/fixtures/flow/interfaces-module-and-script/5/expected.json index 23bbe6bc92..946ad67dca 100644 --- a/test/fixtures/flow/interfaces-module-and-script/5/expected.json +++ b/test/fixtures/flow/interfaces-module-and-script/5/expected.json @@ -129,7 +129,7 @@ { "type": "ObjectTypeIndexer", "start": 23, - "end": 47, + "end": 46, "loc": { "start": { "line": 1, @@ -137,7 +137,7 @@ }, "end": { "line": 1, - "column": 47 + "column": 46 } }, "id": { @@ -194,4 +194,4 @@ ] }, "comments": [] -} \ No newline at end of file +} diff --git a/test/fixtures/flow/type-annotations/41/expected.json b/test/fixtures/flow/type-annotations/41/expected.json index 11f1b5529a..7db814ba65 100644 --- a/test/fixtures/flow/type-annotations/41/expected.json +++ b/test/fixtures/flow/type-annotations/41/expected.json @@ -106,7 +106,7 @@ { "type": "ObjectTypeIndexer", "start": 9, - "end": 29, + "end": 28, "loc": { "start": { "line": 1, @@ -114,7 +114,7 @@ }, "end": { "line": 1, - "column": 29 + "column": 28 } }, "id": { @@ -167,7 +167,7 @@ { "type": "ObjectTypeIndexer", "start": 30, - "end": 50, + "end": 49, "loc": { "start": { "line": 1, @@ -175,7 +175,7 @@ }, "end": { "line": 1, - "column": 50 + "column": 49 } }, "id": { @@ -238,4 +238,4 @@ ] }, "comments": [] -} \ No newline at end of file +}