Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(flow): add multiple declarations regression test
- Loading branch information
Showing
12 changed files
with
694 additions
and
0 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
packages/babel-parser/test/fixtures/flow/multiple-declarations/class/input.js
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 @@ | ||
declare class C1 {} | ||
class C1 {} |
8 changes: 8 additions & 0 deletions
8
packages/babel-parser/test/fixtures/flow/multiple-declarations/class/options.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,8 @@ | ||
{ | ||
"sourceType": "module", | ||
"plugins": [ | ||
"jsx", | ||
"flow" | ||
], | ||
"throws": "Identifier 'C1' has already been declared (2:6)" | ||
} |
6 changes: 6 additions & 0 deletions
6
packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-class/input.js
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,6 @@ | ||
declare class C1{} | ||
declare class C1{} | ||
|
||
declare module M1 { | ||
declare class C1 {} | ||
} |
253 changes: 253 additions & 0 deletions
253
packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-class/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,253 @@ | ||
{ | ||
"type": "File", | ||
"start": 0, | ||
"end": 82, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 6, | ||
"column": 1 | ||
} | ||
}, | ||
"program": { | ||
"type": "Program", | ||
"start": 0, | ||
"end": 82, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 6, | ||
"column": 1 | ||
} | ||
}, | ||
"sourceType": "module", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "DeclareClass", | ||
"start": 0, | ||
"end": 18, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 18 | ||
} | ||
}, | ||
"id": { | ||
"type": "Identifier", | ||
"start": 14, | ||
"end": 16, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 14 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 16 | ||
}, | ||
"identifierName": "C1" | ||
}, | ||
"name": "C1" | ||
}, | ||
"typeParameters": null, | ||
"extends": [], | ||
"implements": [], | ||
"mixins": [], | ||
"body": { | ||
"type": "ObjectTypeAnnotation", | ||
"start": 16, | ||
"end": 18, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 16 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 18 | ||
} | ||
}, | ||
"callProperties": [], | ||
"properties": [], | ||
"indexers": [], | ||
"internalSlots": [], | ||
"exact": false | ||
} | ||
}, | ||
{ | ||
"type": "DeclareClass", | ||
"start": 19, | ||
"end": 37, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 18 | ||
} | ||
}, | ||
"id": { | ||
"type": "Identifier", | ||
"start": 33, | ||
"end": 35, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 14 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 16 | ||
}, | ||
"identifierName": "C1" | ||
}, | ||
"name": "C1" | ||
}, | ||
"typeParameters": null, | ||
"extends": [], | ||
"implements": [], | ||
"mixins": [], | ||
"body": { | ||
"type": "ObjectTypeAnnotation", | ||
"start": 35, | ||
"end": 37, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 16 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 18 | ||
} | ||
}, | ||
"callProperties": [], | ||
"properties": [], | ||
"indexers": [], | ||
"internalSlots": [], | ||
"exact": false | ||
} | ||
}, | ||
{ | ||
"type": "DeclareModule", | ||
"start": 39, | ||
"end": 82, | ||
"loc": { | ||
"start": { | ||
"line": 4, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 6, | ||
"column": 1 | ||
} | ||
}, | ||
"id": { | ||
"type": "Identifier", | ||
"start": 54, | ||
"end": 56, | ||
"loc": { | ||
"start": { | ||
"line": 4, | ||
"column": 15 | ||
}, | ||
"end": { | ||
"line": 4, | ||
"column": 17 | ||
}, | ||
"identifierName": "M1" | ||
}, | ||
"name": "M1" | ||
}, | ||
"body": { | ||
"type": "BlockStatement", | ||
"start": 57, | ||
"end": 82, | ||
"loc": { | ||
"start": { | ||
"line": 4, | ||
"column": 18 | ||
}, | ||
"end": { | ||
"line": 6, | ||
"column": 1 | ||
} | ||
}, | ||
"body": [ | ||
{ | ||
"type": "DeclareClass", | ||
"start": 61, | ||
"end": 80, | ||
"loc": { | ||
"start": { | ||
"line": 5, | ||
"column": 2 | ||
}, | ||
"end": { | ||
"line": 5, | ||
"column": 21 | ||
} | ||
}, | ||
"id": { | ||
"type": "Identifier", | ||
"start": 75, | ||
"end": 77, | ||
"loc": { | ||
"start": { | ||
"line": 5, | ||
"column": 16 | ||
}, | ||
"end": { | ||
"line": 5, | ||
"column": 18 | ||
}, | ||
"identifierName": "C1" | ||
}, | ||
"name": "C1" | ||
}, | ||
"typeParameters": null, | ||
"extends": [], | ||
"implements": [], | ||
"mixins": [], | ||
"body": { | ||
"type": "ObjectTypeAnnotation", | ||
"start": 78, | ||
"end": 80, | ||
"loc": { | ||
"start": { | ||
"line": 5, | ||
"column": 19 | ||
}, | ||
"end": { | ||
"line": 5, | ||
"column": 21 | ||
} | ||
}, | ||
"callProperties": [], | ||
"properties": [], | ||
"indexers": [], | ||
"internalSlots": [], | ||
"exact": false | ||
} | ||
} | ||
] | ||
}, | ||
"kind": "CommonJS" | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-function/input.js
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,3 @@ | ||
declare function F1(): void | ||
declare function F1(): void | ||
function F1() {} |
Oops, something went wrong.