diff --git a/src/plugins/flow.js b/src/plugins/flow.js index 79044f46bf..5114fd8e24 100644 --- a/src/plugins/flow.js +++ b/src/plugins/flow.js @@ -117,6 +117,8 @@ pp.flowParseDeclareModuleExports = function (node) { this.expect(tt.dot); this.expectContextual("exports"); node.typeAnnotation = this.flowParseTypeAnnotation(); + this.semicolon(); + return this.finishNode(node, "DeclareModuleExports"); }; diff --git a/test/fixtures/flow/declare-module/9/actual.js b/test/fixtures/flow/declare-module/9/actual.js new file mode 100644 index 0000000000..a7bea8f920 --- /dev/null +++ b/test/fixtures/flow/declare-module/9/actual.js @@ -0,0 +1 @@ +declare module A { declare module.exports: number; } diff --git a/test/fixtures/flow/declare-module/9/expected.json b/test/fixtures/flow/declare-module/9/expected.json new file mode 100644 index 0000000000..d549499d21 --- /dev/null +++ b/test/fixtures/flow/declare-module/9/expected.json @@ -0,0 +1,128 @@ +{ + "type": "File", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "sourceType": "module", + "body": [ + { + "type": "DeclareModule", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "A" + }, + "name": "A" + }, + "body": { + "type": "BlockStatement", + "start": 17, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "body": [ + { + "type": "DeclareModuleExports", + "start": 19, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 41, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "typeAnnotation": { + "type": "NumberTypeAnnotation", + "start": 43, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 49 + } + } + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file