Merge branch 'master' into decorators-stage-2
This commit is contained in:
5
test/fixtures/estree/class-method/flow/actual.js
vendored
Normal file
5
test/fixtures/estree/class-method/flow/actual.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
class NodeUtils extends UtilParser {
|
||||
finishNodeAt<T : NodeType>(node: T): T {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
400
test/fixtures/estree/class-method/flow/expected.json
vendored
Normal file
400
test/fixtures/estree/class-method/flow/expected.json
vendored
Normal file
@@ -0,0 +1,400 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 102,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 5,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 102,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 5,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"body": [
|
||||
{
|
||||
"type": "ClassDeclaration",
|
||||
"start": 0,
|
||||
"end": 102,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 5,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 6,
|
||||
"end": 15,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 15
|
||||
},
|
||||
"identifierName": "NodeUtils"
|
||||
},
|
||||
"name": "NodeUtils"
|
||||
},
|
||||
"superClass": {
|
||||
"type": "Identifier",
|
||||
"start": 24,
|
||||
"end": 34,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 24
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 34
|
||||
},
|
||||
"identifierName": "UtilParser"
|
||||
},
|
||||
"name": "UtilParser"
|
||||
},
|
||||
"body": {
|
||||
"type": "ClassBody",
|
||||
"start": 35,
|
||||
"end": 102,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 35
|
||||
},
|
||||
"end": {
|
||||
"line": 5,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"body": [
|
||||
{
|
||||
"type": "MethodDefinition",
|
||||
"start": 39,
|
||||
"end": 100,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 3
|
||||
}
|
||||
},
|
||||
"static": false,
|
||||
"computed": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 39,
|
||||
"end": 51,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 14
|
||||
},
|
||||
"identifierName": "finishNodeAt"
|
||||
},
|
||||
"name": "finishNodeAt"
|
||||
},
|
||||
"kind": "method",
|
||||
"value": {
|
||||
"type": "FunctionExpression",
|
||||
"start": 65,
|
||||
"end": 100,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 28
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 3
|
||||
}
|
||||
},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"expression": false,
|
||||
"async": false,
|
||||
"params": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start": 66,
|
||||
"end": 73,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 29
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 36
|
||||
},
|
||||
"identifierName": "node"
|
||||
},
|
||||
"name": "node",
|
||||
"typeAnnotation": {
|
||||
"type": "TypeAnnotation",
|
||||
"start": 70,
|
||||
"end": 73,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 33
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 36
|
||||
}
|
||||
},
|
||||
"typeAnnotation": {
|
||||
"type": "GenericTypeAnnotation",
|
||||
"start": 72,
|
||||
"end": 73,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 35
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 36
|
||||
}
|
||||
},
|
||||
"typeParameters": null,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 72,
|
||||
"end": 73,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 35
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 36
|
||||
},
|
||||
"identifierName": "T"
|
||||
},
|
||||
"name": "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"predicate": null,
|
||||
"returnType": {
|
||||
"type": "TypeAnnotation",
|
||||
"start": 74,
|
||||
"end": 77,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 37
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 40
|
||||
}
|
||||
},
|
||||
"typeAnnotation": {
|
||||
"type": "GenericTypeAnnotation",
|
||||
"start": 76,
|
||||
"end": 77,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 39
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 40
|
||||
}
|
||||
},
|
||||
"typeParameters": null,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 76,
|
||||
"end": 77,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 39
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 40
|
||||
},
|
||||
"identifierName": "T"
|
||||
},
|
||||
"name": "T"
|
||||
}
|
||||
}
|
||||
},
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start": 78,
|
||||
"end": 100,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 41
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 3
|
||||
}
|
||||
},
|
||||
"body": [
|
||||
{
|
||||
"type": "ReturnStatement",
|
||||
"start": 84,
|
||||
"end": 96,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"argument": {
|
||||
"type": "Identifier",
|
||||
"start": 91,
|
||||
"end": 95,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 11
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 15
|
||||
},
|
||||
"identifierName": "node"
|
||||
},
|
||||
"name": "node"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"typeParameters": {
|
||||
"type": "TypeParameterDeclaration",
|
||||
"start": 51,
|
||||
"end": 65,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 14
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 28
|
||||
}
|
||||
},
|
||||
"params": [
|
||||
{
|
||||
"type": "TypeParameter",
|
||||
"start": 52,
|
||||
"end": 64,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 15
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 27
|
||||
}
|
||||
},
|
||||
"name": "T",
|
||||
"variance": null,
|
||||
"bound": {
|
||||
"type": "TypeAnnotation",
|
||||
"start": 54,
|
||||
"end": 64,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 17
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 27
|
||||
}
|
||||
},
|
||||
"typeAnnotation": {
|
||||
"type": "GenericTypeAnnotation",
|
||||
"start": 56,
|
||||
"end": 64,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 19
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 27
|
||||
}
|
||||
},
|
||||
"typeParameters": null,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 56,
|
||||
"end": 64,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 19
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 27
|
||||
},
|
||||
"identifierName": "NodeType"
|
||||
},
|
||||
"name": "NodeType"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -158,7 +158,8 @@
|
||||
},
|
||||
"body": []
|
||||
}
|
||||
}
|
||||
},
|
||||
"shorthand": false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
1
test/fixtures/flow/type-annotations/function-expression-inside-jsx-attr/actual.js
vendored
Normal file
1
test/fixtures/flow/type-annotations/function-expression-inside-jsx-attr/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<bar x={function (x): Array<string> {}} />
|
||||
281
test/fixtures/flow/type-annotations/function-expression-inside-jsx-attr/expected.json
vendored
Normal file
281
test/fixtures/flow/type-annotations/function-expression-inside-jsx-attr/expected.json
vendored
Normal file
@@ -0,0 +1,281 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 42,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 42
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 42,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 42
|
||||
}
|
||||
},
|
||||
"sourceType": "module",
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 0,
|
||||
"end": 42,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 42
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "JSXElement",
|
||||
"start": 0,
|
||||
"end": 42,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 42
|
||||
}
|
||||
},
|
||||
"openingElement": {
|
||||
"type": "JSXOpeningElement",
|
||||
"start": 0,
|
||||
"end": 42,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 42
|
||||
}
|
||||
},
|
||||
"attributes": [
|
||||
{
|
||||
"type": "JSXAttribute",
|
||||
"start": 5,
|
||||
"end": 39,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 39
|
||||
}
|
||||
},
|
||||
"name": {
|
||||
"type": "JSXIdentifier",
|
||||
"start": 5,
|
||||
"end": 6,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 6
|
||||
}
|
||||
},
|
||||
"name": "x"
|
||||
},
|
||||
"value": {
|
||||
"type": "JSXExpressionContainer",
|
||||
"start": 7,
|
||||
"end": 39,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 7
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 39
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "FunctionExpression",
|
||||
"start": 8,
|
||||
"end": 38,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 8
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 38
|
||||
}
|
||||
},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"expression": false,
|
||||
"async": false,
|
||||
"params": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start": 18,
|
||||
"end": 19,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 18
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 19
|
||||
},
|
||||
"identifierName": "x"
|
||||
},
|
||||
"name": "x"
|
||||
}
|
||||
],
|
||||
"predicate": null,
|
||||
"returnType": {
|
||||
"type": "TypeAnnotation",
|
||||
"start": 20,
|
||||
"end": 35,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 20
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 35
|
||||
}
|
||||
},
|
||||
"typeAnnotation": {
|
||||
"type": "GenericTypeAnnotation",
|
||||
"start": 22,
|
||||
"end": 35,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 22
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 35
|
||||
}
|
||||
},
|
||||
"typeParameters": {
|
||||
"type": "TypeParameterInstantiation",
|
||||
"start": 27,
|
||||
"end": 35,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 27
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 35
|
||||
}
|
||||
},
|
||||
"params": [
|
||||
{
|
||||
"type": "StringTypeAnnotation",
|
||||
"start": 28,
|
||||
"end": 34,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 28
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 34
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 22,
|
||||
"end": 27,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 22
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 27
|
||||
},
|
||||
"identifierName": "Array"
|
||||
},
|
||||
"name": "Array"
|
||||
}
|
||||
}
|
||||
},
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start": 36,
|
||||
"end": 38,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 36
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 38
|
||||
}
|
||||
},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"name": {
|
||||
"type": "JSXIdentifier",
|
||||
"start": 1,
|
||||
"end": 4,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 1
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 4
|
||||
}
|
||||
},
|
||||
"name": "bar"
|
||||
},
|
||||
"selfClosing": true
|
||||
},
|
||||
"closingElement": null,
|
||||
"children": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user