Skip to content
This repository has been archived by the owner on May 19, 2018. It is now read-only.

Correctly eat semicolon at the end of DelcareModuleExports #223

Merged
merged 1 commit into from
Nov 14, 2016
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
2 changes: 2 additions & 0 deletions src/plugins/flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
};

Expand Down
1 change: 1 addition & 0 deletions test/fixtures/flow/declare-module/9/actual.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module A { declare module.exports: number; }
128 changes: 128 additions & 0 deletions test/fixtures/flow/declare-module/9/expected.json
Original file line number Diff line number Diff line change
@@ -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": []
}
}