Rename "babylon" to "@babel/parser" (#7937) 🎉
This commit is contained in:
committed by
Henry Zhu
parent
0200a3e510
commit
daf0ca8680
3
packages/babel-parser/test/fixtures/flow/iterator/01/input.js
vendored
Normal file
3
packages/babel-parser/test/fixtures/flow/iterator/01/input.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
declare class A {
|
||||
@@iterator(): Iterator<File>;
|
||||
}
|
||||
227
packages/babel-parser/test/fixtures/flow/iterator/01/output.json
vendored
Normal file
227
packages/babel-parser/test/fixtures/flow/iterator/01/output.json
vendored
Normal file
@@ -0,0 +1,227 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 51,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 51,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"sourceType": "module",
|
||||
"body": [
|
||||
{
|
||||
"type": "DeclareClass",
|
||||
"start": 0,
|
||||
"end": 51,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 14,
|
||||
"end": 15,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 14
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 15
|
||||
},
|
||||
"identifierName": "A"
|
||||
},
|
||||
"name": "A"
|
||||
},
|
||||
"typeParameters": null,
|
||||
"extends": [],
|
||||
"implements": [],
|
||||
"mixins": [],
|
||||
"body": {
|
||||
"type": "ObjectTypeAnnotation",
|
||||
"start": 16,
|
||||
"end": 51,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 16
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"callProperties": [],
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectTypeProperty",
|
||||
"start": 20,
|
||||
"end": 48,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 30
|
||||
}
|
||||
},
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 20,
|
||||
"end": 30,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 12
|
||||
},
|
||||
"identifierName": "@@iterator"
|
||||
},
|
||||
"name": "@@iterator"
|
||||
},
|
||||
"static": false,
|
||||
"kind": "init",
|
||||
"method": true,
|
||||
"value": {
|
||||
"type": "FunctionTypeAnnotation",
|
||||
"start": 20,
|
||||
"end": 48,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 30
|
||||
}
|
||||
},
|
||||
"params": [],
|
||||
"rest": null,
|
||||
"typeParameters": null,
|
||||
"returnType": {
|
||||
"type": "GenericTypeAnnotation",
|
||||
"start": 34,
|
||||
"end": 48,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 16
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 30
|
||||
}
|
||||
},
|
||||
"typeParameters": {
|
||||
"type": "TypeParameterInstantiation",
|
||||
"start": 42,
|
||||
"end": 48,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 24
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 30
|
||||
}
|
||||
},
|
||||
"params": [
|
||||
{
|
||||
"type": "GenericTypeAnnotation",
|
||||
"start": 43,
|
||||
"end": 47,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 25
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 29
|
||||
}
|
||||
},
|
||||
"typeParameters": null,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 43,
|
||||
"end": 47,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 25
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 29
|
||||
},
|
||||
"identifierName": "File"
|
||||
},
|
||||
"name": "File"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 34,
|
||||
"end": 42,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 16
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 24
|
||||
},
|
||||
"identifierName": "Iterator"
|
||||
},
|
||||
"name": "Iterator"
|
||||
}
|
||||
}
|
||||
},
|
||||
"optional": false
|
||||
}
|
||||
],
|
||||
"indexers": [],
|
||||
"internalSlots": [],
|
||||
"exact": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
3
packages/babel-parser/test/fixtures/flow/iterator/02/input.js
vendored
Normal file
3
packages/babel-parser/test/fixtures/flow/iterator/02/input.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
declare class A {
|
||||
@@asyncIterator(): Iterator<File>;
|
||||
}
|
||||
227
packages/babel-parser/test/fixtures/flow/iterator/02/output.json
vendored
Normal file
227
packages/babel-parser/test/fixtures/flow/iterator/02/output.json
vendored
Normal file
@@ -0,0 +1,227 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 56,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 56,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"sourceType": "module",
|
||||
"body": [
|
||||
{
|
||||
"type": "DeclareClass",
|
||||
"start": 0,
|
||||
"end": 56,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 14,
|
||||
"end": 15,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 14
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 15
|
||||
},
|
||||
"identifierName": "A"
|
||||
},
|
||||
"name": "A"
|
||||
},
|
||||
"typeParameters": null,
|
||||
"extends": [],
|
||||
"implements": [],
|
||||
"mixins": [],
|
||||
"body": {
|
||||
"type": "ObjectTypeAnnotation",
|
||||
"start": 16,
|
||||
"end": 56,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 16
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"callProperties": [],
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectTypeProperty",
|
||||
"start": 20,
|
||||
"end": 53,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 35
|
||||
}
|
||||
},
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 20,
|
||||
"end": 35,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 17
|
||||
},
|
||||
"identifierName": "@@asyncIterator"
|
||||
},
|
||||
"name": "@@asyncIterator"
|
||||
},
|
||||
"static": false,
|
||||
"kind": "init",
|
||||
"method": true,
|
||||
"value": {
|
||||
"type": "FunctionTypeAnnotation",
|
||||
"start": 20,
|
||||
"end": 53,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 35
|
||||
}
|
||||
},
|
||||
"params": [],
|
||||
"rest": null,
|
||||
"typeParameters": null,
|
||||
"returnType": {
|
||||
"type": "GenericTypeAnnotation",
|
||||
"start": 39,
|
||||
"end": 53,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 21
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 35
|
||||
}
|
||||
},
|
||||
"typeParameters": {
|
||||
"type": "TypeParameterInstantiation",
|
||||
"start": 47,
|
||||
"end": 53,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 29
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 35
|
||||
}
|
||||
},
|
||||
"params": [
|
||||
{
|
||||
"type": "GenericTypeAnnotation",
|
||||
"start": 48,
|
||||
"end": 52,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 30
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 34
|
||||
}
|
||||
},
|
||||
"typeParameters": null,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 48,
|
||||
"end": 52,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 30
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 34
|
||||
},
|
||||
"identifierName": "File"
|
||||
},
|
||||
"name": "File"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 39,
|
||||
"end": 47,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 21
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 29
|
||||
},
|
||||
"identifierName": "Iterator"
|
||||
},
|
||||
"name": "Iterator"
|
||||
}
|
||||
}
|
||||
},
|
||||
"optional": false
|
||||
}
|
||||
],
|
||||
"indexers": [],
|
||||
"internalSlots": [],
|
||||
"exact": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
1
packages/babel-parser/test/fixtures/flow/iterator/03/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/flow/iterator/03/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
var @@asyncIterator;
|
||||
3
packages/babel-parser/test/fixtures/flow/iterator/03/options.json
vendored
Normal file
3
packages/babel-parser/test/fixtures/flow/iterator/03/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Invalid identifier @@asyncIterator (1:19)"
|
||||
}
|
||||
1
packages/babel-parser/test/fixtures/flow/iterator/04/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/flow/iterator/04/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
var @@iterator;
|
||||
3
packages/babel-parser/test/fixtures/flow/iterator/04/options.json
vendored
Normal file
3
packages/babel-parser/test/fixtures/flow/iterator/04/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Invalid identifier @@iterator (1:14)"
|
||||
}
|
||||
3
packages/babel-parser/test/fixtures/flow/iterator/05/input.js
vendored
Normal file
3
packages/babel-parser/test/fixtures/flow/iterator/05/input.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
class T {
|
||||
@@asyncIterator(){}
|
||||
}
|
||||
3
packages/babel-parser/test/fixtures/flow/iterator/05/options.json
vendored
Normal file
3
packages/babel-parser/test/fixtures/flow/iterator/05/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Invalid identifier @@asyncIterator (2:17)"
|
||||
}
|
||||
3
packages/babel-parser/test/fixtures/flow/iterator/06/input.js
vendored
Normal file
3
packages/babel-parser/test/fixtures/flow/iterator/06/input.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
class T {
|
||||
@@iterator(){}
|
||||
}
|
||||
3
packages/babel-parser/test/fixtures/flow/iterator/06/options.json
vendored
Normal file
3
packages/babel-parser/test/fixtures/flow/iterator/06/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Invalid identifier @@iterator (2:12)"
|
||||
}
|
||||
1
packages/babel-parser/test/fixtures/flow/iterator/07/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/flow/iterator/07/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
type @@iterator = number
|
||||
3
packages/babel-parser/test/fixtures/flow/iterator/07/options.json
vendored
Normal file
3
packages/babel-parser/test/fixtures/flow/iterator/07/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Invalid identifier @@iterator (1:15)"
|
||||
}
|
||||
1
packages/babel-parser/test/fixtures/flow/iterator/08/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/flow/iterator/08/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
type @@asyncIterator = number
|
||||
3
packages/babel-parser/test/fixtures/flow/iterator/08/options.json
vendored
Normal file
3
packages/babel-parser/test/fixtures/flow/iterator/08/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Invalid identifier @@asyncIterator (1:20)"
|
||||
}
|
||||
3
packages/babel-parser/test/fixtures/flow/iterator/09/input.js
vendored
Normal file
3
packages/babel-parser/test/fixtures/flow/iterator/09/input.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
let x = {
|
||||
@@iterator() {}
|
||||
}
|
||||
3
packages/babel-parser/test/fixtures/flow/iterator/09/options.json
vendored
Normal file
3
packages/babel-parser/test/fixtures/flow/iterator/09/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Invalid identifier @@iterator (2:12)"
|
||||
}
|
||||
3
packages/babel-parser/test/fixtures/flow/iterator/10/input.js
vendored
Normal file
3
packages/babel-parser/test/fixtures/flow/iterator/10/input.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
let x = {
|
||||
@@asyncIterator() {}
|
||||
}
|
||||
3
packages/babel-parser/test/fixtures/flow/iterator/10/options.json
vendored
Normal file
3
packages/babel-parser/test/fixtures/flow/iterator/10/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Invalid identifier @@asyncIterator (2:17)"
|
||||
}
|
||||
3
packages/babel-parser/test/fixtures/flow/iterator/11/input.js
vendored
Normal file
3
packages/babel-parser/test/fixtures/flow/iterator/11/input.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
let x = {
|
||||
@@random() {}
|
||||
}
|
||||
3
packages/babel-parser/test/fixtures/flow/iterator/11/options.json
vendored
Normal file
3
packages/babel-parser/test/fixtures/flow/iterator/11/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Invalid identifier @@random (2:10)"
|
||||
}
|
||||
3
packages/babel-parser/test/fixtures/flow/iterator/12/input.js
vendored
Normal file
3
packages/babel-parser/test/fixtures/flow/iterator/12/input.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
function foo(): { @@iterator: () => string } {
|
||||
return (0: any);
|
||||
}
|
||||
278
packages/babel-parser/test/fixtures/flow/iterator/12/output.json
vendored
Normal file
278
packages/babel-parser/test/fixtures/flow/iterator/12/output.json
vendored
Normal file
@@ -0,0 +1,278 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 67,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 67,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"sourceType": "module",
|
||||
"body": [
|
||||
{
|
||||
"type": "FunctionDeclaration",
|
||||
"start": 0,
|
||||
"end": 67,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 9,
|
||||
"end": 12,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 12
|
||||
},
|
||||
"identifierName": "foo"
|
||||
},
|
||||
"name": "foo"
|
||||
},
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [],
|
||||
"predicate": null,
|
||||
"returnType": {
|
||||
"type": "TypeAnnotation",
|
||||
"start": 14,
|
||||
"end": 44,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 14
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 44
|
||||
}
|
||||
},
|
||||
"typeAnnotation": {
|
||||
"type": "ObjectTypeAnnotation",
|
||||
"start": 16,
|
||||
"end": 44,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 16
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 44
|
||||
}
|
||||
},
|
||||
"callProperties": [],
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectTypeProperty",
|
||||
"start": 18,
|
||||
"end": 42,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 18
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 42
|
||||
}
|
||||
},
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 18,
|
||||
"end": 28,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 18
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 28
|
||||
},
|
||||
"identifierName": "@@iterator"
|
||||
},
|
||||
"name": "@@iterator"
|
||||
},
|
||||
"static": false,
|
||||
"kind": "init",
|
||||
"method": false,
|
||||
"value": {
|
||||
"type": "FunctionTypeAnnotation",
|
||||
"start": 30,
|
||||
"end": 42,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 30
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 42
|
||||
}
|
||||
},
|
||||
"params": [],
|
||||
"rest": null,
|
||||
"returnType": {
|
||||
"type": "StringTypeAnnotation",
|
||||
"start": 36,
|
||||
"end": 42,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 36
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 42
|
||||
}
|
||||
}
|
||||
},
|
||||
"typeParameters": null
|
||||
},
|
||||
"variance": null,
|
||||
"optional": false
|
||||
}
|
||||
],
|
||||
"indexers": [],
|
||||
"internalSlots": [],
|
||||
"exact": false
|
||||
}
|
||||
},
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start": 45,
|
||||
"end": 67,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 45
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"body": [
|
||||
{
|
||||
"type": "ReturnStatement",
|
||||
"start": 49,
|
||||
"end": 65,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 18
|
||||
}
|
||||
},
|
||||
"argument": {
|
||||
"type": "TypeCastExpression",
|
||||
"start": 57,
|
||||
"end": 63,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 10
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "NumericLiteral",
|
||||
"start": 57,
|
||||
"end": 58,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 10
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 11
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 0,
|
||||
"raw": "0"
|
||||
},
|
||||
"value": 0
|
||||
},
|
||||
"typeAnnotation": {
|
||||
"type": "TypeAnnotation",
|
||||
"start": 58,
|
||||
"end": 63,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 11
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"typeAnnotation": {
|
||||
"type": "AnyTypeAnnotation",
|
||||
"start": 60,
|
||||
"end": 63,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 13
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 16
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 56
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
3
packages/babel-parser/test/fixtures/flow/iterator/13/input.js
vendored
Normal file
3
packages/babel-parser/test/fixtures/flow/iterator/13/input.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
function foo(): { @@asyncIterator: () => string } {
|
||||
return (0: any);
|
||||
}
|
||||
278
packages/babel-parser/test/fixtures/flow/iterator/13/output.json
vendored
Normal file
278
packages/babel-parser/test/fixtures/flow/iterator/13/output.json
vendored
Normal file
@@ -0,0 +1,278 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 72,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 72,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"sourceType": "module",
|
||||
"body": [
|
||||
{
|
||||
"type": "FunctionDeclaration",
|
||||
"start": 0,
|
||||
"end": 72,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 9,
|
||||
"end": 12,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 12
|
||||
},
|
||||
"identifierName": "foo"
|
||||
},
|
||||
"name": "foo"
|
||||
},
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [],
|
||||
"predicate": null,
|
||||
"returnType": {
|
||||
"type": "TypeAnnotation",
|
||||
"start": 14,
|
||||
"end": 49,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 14
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 49
|
||||
}
|
||||
},
|
||||
"typeAnnotation": {
|
||||
"type": "ObjectTypeAnnotation",
|
||||
"start": 16,
|
||||
"end": 49,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 16
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 49
|
||||
}
|
||||
},
|
||||
"callProperties": [],
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectTypeProperty",
|
||||
"start": 18,
|
||||
"end": 47,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 18
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 47
|
||||
}
|
||||
},
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 18,
|
||||
"end": 33,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 18
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 33
|
||||
},
|
||||
"identifierName": "@@asyncIterator"
|
||||
},
|
||||
"name": "@@asyncIterator"
|
||||
},
|
||||
"static": false,
|
||||
"kind": "init",
|
||||
"method": false,
|
||||
"value": {
|
||||
"type": "FunctionTypeAnnotation",
|
||||
"start": 35,
|
||||
"end": 47,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 35
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 47
|
||||
}
|
||||
},
|
||||
"params": [],
|
||||
"rest": null,
|
||||
"returnType": {
|
||||
"type": "StringTypeAnnotation",
|
||||
"start": 41,
|
||||
"end": 47,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 41
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 47
|
||||
}
|
||||
}
|
||||
},
|
||||
"typeParameters": null
|
||||
},
|
||||
"variance": null,
|
||||
"optional": false
|
||||
}
|
||||
],
|
||||
"indexers": [],
|
||||
"internalSlots": [],
|
||||
"exact": false
|
||||
}
|
||||
},
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start": 50,
|
||||
"end": 72,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 50
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"body": [
|
||||
{
|
||||
"type": "ReturnStatement",
|
||||
"start": 54,
|
||||
"end": 70,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 18
|
||||
}
|
||||
},
|
||||
"argument": {
|
||||
"type": "TypeCastExpression",
|
||||
"start": 62,
|
||||
"end": 68,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 10
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "NumericLiteral",
|
||||
"start": 62,
|
||||
"end": 63,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 10
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 11
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 0,
|
||||
"raw": "0"
|
||||
},
|
||||
"value": 0
|
||||
},
|
||||
"typeAnnotation": {
|
||||
"type": "TypeAnnotation",
|
||||
"start": 63,
|
||||
"end": 68,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 11
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"typeAnnotation": {
|
||||
"type": "AnyTypeAnnotation",
|
||||
"start": 65,
|
||||
"end": 68,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 13
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 16
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 61
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
3
packages/babel-parser/test/fixtures/flow/iterator/14/input.js
vendored
Normal file
3
packages/babel-parser/test/fixtures/flow/iterator/14/input.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
interface A {
|
||||
@@iterator(): Iterator<File>;
|
||||
}
|
||||
227
packages/babel-parser/test/fixtures/flow/iterator/14/output.json
vendored
Normal file
227
packages/babel-parser/test/fixtures/flow/iterator/14/output.json
vendored
Normal file
@@ -0,0 +1,227 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 47,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 47,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"sourceType": "module",
|
||||
"body": [
|
||||
{
|
||||
"type": "InterfaceDeclaration",
|
||||
"start": 0,
|
||||
"end": 47,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 10,
|
||||
"end": 11,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 10
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 11
|
||||
},
|
||||
"identifierName": "A"
|
||||
},
|
||||
"name": "A"
|
||||
},
|
||||
"typeParameters": null,
|
||||
"extends": [],
|
||||
"implements": [],
|
||||
"mixins": [],
|
||||
"body": {
|
||||
"type": "ObjectTypeAnnotation",
|
||||
"start": 12,
|
||||
"end": 47,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"callProperties": [],
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectTypeProperty",
|
||||
"start": 16,
|
||||
"end": 44,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 30
|
||||
}
|
||||
},
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 16,
|
||||
"end": 26,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 12
|
||||
},
|
||||
"identifierName": "@@iterator"
|
||||
},
|
||||
"name": "@@iterator"
|
||||
},
|
||||
"static": false,
|
||||
"kind": "init",
|
||||
"method": true,
|
||||
"value": {
|
||||
"type": "FunctionTypeAnnotation",
|
||||
"start": 16,
|
||||
"end": 44,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 30
|
||||
}
|
||||
},
|
||||
"params": [],
|
||||
"rest": null,
|
||||
"typeParameters": null,
|
||||
"returnType": {
|
||||
"type": "GenericTypeAnnotation",
|
||||
"start": 30,
|
||||
"end": 44,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 16
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 30
|
||||
}
|
||||
},
|
||||
"typeParameters": {
|
||||
"type": "TypeParameterInstantiation",
|
||||
"start": 38,
|
||||
"end": 44,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 24
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 30
|
||||
}
|
||||
},
|
||||
"params": [
|
||||
{
|
||||
"type": "GenericTypeAnnotation",
|
||||
"start": 39,
|
||||
"end": 43,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 25
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 29
|
||||
}
|
||||
},
|
||||
"typeParameters": null,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 39,
|
||||
"end": 43,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 25
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 29
|
||||
},
|
||||
"identifierName": "File"
|
||||
},
|
||||
"name": "File"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 30,
|
||||
"end": 38,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 16
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 24
|
||||
},
|
||||
"identifierName": "Iterator"
|
||||
},
|
||||
"name": "Iterator"
|
||||
}
|
||||
}
|
||||
},
|
||||
"optional": false
|
||||
}
|
||||
],
|
||||
"indexers": [],
|
||||
"internalSlots": [],
|
||||
"exact": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
3
packages/babel-parser/test/fixtures/flow/iterator/15/input.js
vendored
Normal file
3
packages/babel-parser/test/fixtures/flow/iterator/15/input.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
interface A {
|
||||
@@asyncIterator(): Iterator<File>;
|
||||
}
|
||||
227
packages/babel-parser/test/fixtures/flow/iterator/15/output.json
vendored
Normal file
227
packages/babel-parser/test/fixtures/flow/iterator/15/output.json
vendored
Normal file
@@ -0,0 +1,227 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 52,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 52,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"sourceType": "module",
|
||||
"body": [
|
||||
{
|
||||
"type": "InterfaceDeclaration",
|
||||
"start": 0,
|
||||
"end": 52,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 10,
|
||||
"end": 11,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 10
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 11
|
||||
},
|
||||
"identifierName": "A"
|
||||
},
|
||||
"name": "A"
|
||||
},
|
||||
"typeParameters": null,
|
||||
"extends": [],
|
||||
"implements": [],
|
||||
"mixins": [],
|
||||
"body": {
|
||||
"type": "ObjectTypeAnnotation",
|
||||
"start": 12,
|
||||
"end": 52,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"callProperties": [],
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectTypeProperty",
|
||||
"start": 16,
|
||||
"end": 49,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 35
|
||||
}
|
||||
},
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 16,
|
||||
"end": 31,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 17
|
||||
},
|
||||
"identifierName": "@@asyncIterator"
|
||||
},
|
||||
"name": "@@asyncIterator"
|
||||
},
|
||||
"static": false,
|
||||
"kind": "init",
|
||||
"method": true,
|
||||
"value": {
|
||||
"type": "FunctionTypeAnnotation",
|
||||
"start": 16,
|
||||
"end": 49,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 35
|
||||
}
|
||||
},
|
||||
"params": [],
|
||||
"rest": null,
|
||||
"typeParameters": null,
|
||||
"returnType": {
|
||||
"type": "GenericTypeAnnotation",
|
||||
"start": 35,
|
||||
"end": 49,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 21
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 35
|
||||
}
|
||||
},
|
||||
"typeParameters": {
|
||||
"type": "TypeParameterInstantiation",
|
||||
"start": 43,
|
||||
"end": 49,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 29
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 35
|
||||
}
|
||||
},
|
||||
"params": [
|
||||
{
|
||||
"type": "GenericTypeAnnotation",
|
||||
"start": 44,
|
||||
"end": 48,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 30
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 34
|
||||
}
|
||||
},
|
||||
"typeParameters": null,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 44,
|
||||
"end": 48,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 30
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 34
|
||||
},
|
||||
"identifierName": "File"
|
||||
},
|
||||
"name": "File"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 35,
|
||||
"end": 43,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 21
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 29
|
||||
},
|
||||
"identifierName": "Iterator"
|
||||
},
|
||||
"name": "Iterator"
|
||||
}
|
||||
}
|
||||
},
|
||||
"optional": false
|
||||
}
|
||||
],
|
||||
"indexers": [],
|
||||
"internalSlots": [],
|
||||
"exact": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user