Merge branch 'master' into 7.0

This commit is contained in:
Henry Zhu
2017-02-28 14:37:13 -05:00
30 changed files with 1931 additions and 973 deletions

View File

@@ -1,2 +0,0 @@
export async function foo() {}
export default async function bar() {}

View File

@@ -1,172 +0,0 @@
{
"type": "File",
"start": 0,
"end": 69,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 2,
"column": 38
}
},
"program": {
"type": "Program",
"start": 0,
"end": 69,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 2,
"column": 38
}
},
"sourceType": "module",
"body": [
{
"type": "ExportNamedDeclaration",
"start": 0,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 30
}
},
"specifiers": [],
"source": null,
"declaration": {
"type": "FunctionDeclaration",
"start": 7,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 30
}
},
"id": {
"type": "Identifier",
"start": 22,
"end": 25,
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 25
},
"identifierName": "foo"
},
"name": "foo"
},
"generator": false,
"expression": false,
"async": true,
"params": [],
"body": {
"type": "BlockStatement",
"start": 28,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 28
},
"end": {
"line": 1,
"column": 30
}
},
"body": [],
"directives": []
}
}
},
{
"type": "ExportDefaultDeclaration",
"start": 31,
"end": 69,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 38
}
},
"declaration": {
"type": "FunctionDeclaration",
"start": 46,
"end": 69,
"loc": {
"start": {
"line": 2,
"column": 15
},
"end": {
"line": 2,
"column": 38
}
},
"id": {
"type": "Identifier",
"start": 61,
"end": 64,
"loc": {
"start": {
"line": 2,
"column": 30
},
"end": {
"line": 2,
"column": 33
},
"identifierName": "bar"
},
"name": "bar"
},
"generator": false,
"expression": false,
"async": true,
"params": [],
"body": {
"type": "BlockStatement",
"start": 67,
"end": 69,
"loc": {
"start": {
"line": 2,
"column": 36
},
"end": {
"line": 2,
"column": 38
}
},
"body": [],
"directives": []
}
}
}
],
"directives": []
}
}

View File

@@ -1,3 +1,3 @@
(function*() {
{ *[yield iter]() {} }
return { *[yield iter]() {} }
})

View File

@@ -0,0 +1,197 @@
{
"type": "File",
"start": 0,
"end": 51,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 2
}
},
"program": {
"type": "Program",
"start": 0,
"end": 51,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 2
}
},
"sourceType": "script",
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 51,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 2
}
},
"expression": {
"type": "FunctionExpression",
"start": 1,
"end": 50,
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 3,
"column": 1
}
},
"id": null,
"generator": true,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 13,
"end": 50,
"loc": {
"start": {
"line": 1,
"column": 13
},
"end": {
"line": 3,
"column": 1
}
},
"body": [
{
"type": "ReturnStatement",
"start": 19,
"end": 48,
"loc": {
"start": {
"line": 2,
"column": 4
},
"end": {
"line": 2,
"column": 33
}
},
"argument": {
"type": "ObjectExpression",
"start": 26,
"end": 48,
"loc": {
"start": {
"line": 2,
"column": 11
},
"end": {
"line": 2,
"column": 33
}
},
"properties": [
{
"type": "ObjectMethod",
"start": 28,
"end": 46,
"loc": {
"start": {
"line": 2,
"column": 13
},
"end": {
"line": 2,
"column": 31
}
},
"method": true,
"shorthand": false,
"computed": true,
"key": {
"type": "YieldExpression",
"start": 30,
"end": 40,
"loc": {
"start": {
"line": 2,
"column": 15
},
"end": {
"line": 2,
"column": 25
}
},
"delegate": false,
"argument": {
"type": "Identifier",
"start": 36,
"end": 40,
"loc": {
"start": {
"line": 2,
"column": 21
},
"end": {
"line": 2,
"column": 25
},
"identifierName": "iter"
},
"name": "iter"
}
},
"kind": "method",
"id": null,
"generator": true,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 44,
"end": 46,
"loc": {
"start": {
"line": 2,
"column": 29
},
"end": {
"line": 2,
"column": 31
}
},
"body": [],
"directives": []
}
}
]
}
}
],
"directives": []
},
"extra": {
"parenthesized": true,
"parenStart": 0
}
}
}
],
"directives": []
}
}

View File

@@ -1,3 +0,0 @@
{
"throws": "Unexpected token (2:6)"
}

View File

@@ -1,3 +0,0 @@
class Foo {
bar: string = 'bizz';
}

View File

@@ -1,4 +0,0 @@
{
"plugins": ["flow"],
"throws": "You can only use Class Properties when the 'classProperties' plugin is enabled. (2:14)"
}

View File

@@ -1,3 +0,0 @@
class Foo {
bar = 'bizz';
}

View File

@@ -1,3 +0,0 @@
{
"throws": "You can only use Class Properties when the 'classProperties' plugin is enabled. (2:2)"
}

View File

@@ -1,3 +0,0 @@
class Foo {
bar;
}

View File

@@ -1,3 +0,0 @@
{
"throws": "You can only use Class Properties when the 'classProperties' plugin is enabled. (2:2)"
}

View File

@@ -0,0 +1,7 @@
@ParentDecorator
export default class ParentClass {
makeNestedClass() {
class NestedClass {
}
}
}

View File

@@ -0,0 +1,240 @@
{
"type": "File",
"start": 0,
"end": 109,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 7,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 109,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 7,
"column": 1
}
},
"sourceType": "module",
"body": [
{
"type": "ExportDefaultDeclaration",
"start": 17,
"end": 109,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 7,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 32,
"end": 109,
"loc": {
"start": {
"line": 2,
"column": 15
},
"end": {
"line": 7,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 38,
"end": 49,
"loc": {
"start": {
"line": 2,
"column": 21
},
"end": {
"line": 2,
"column": 32
},
"identifierName": "ParentClass"
},
"name": "ParentClass"
},
"decorators": [
{
"type": "Decorator",
"start": 0,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 16
}
},
"expression": {
"type": "Identifier",
"start": 1,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 16
},
"identifierName": "ParentDecorator"
},
"name": "ParentDecorator"
}
}
],
"superClass": null,
"body": {
"type": "ClassBody",
"start": 50,
"end": 109,
"loc": {
"start": {
"line": 2,
"column": 33
},
"end": {
"line": 7,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 54,
"end": 107,
"loc": {
"start": {
"line": 3,
"column": 2
},
"end": {
"line": 6,
"column": 3
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 54,
"end": 69,
"loc": {
"start": {
"line": 3,
"column": 2
},
"end": {
"line": 3,
"column": 17
},
"identifierName": "makeNestedClass"
},
"name": "makeNestedClass"
},
"static": false,
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 72,
"end": 107,
"loc": {
"start": {
"line": 3,
"column": 20
},
"end": {
"line": 6,
"column": 3
}
},
"body": [
{
"type": "ClassDeclaration",
"start": 78,
"end": 103,
"loc": {
"start": {
"line": 4,
"column": 4
},
"end": {
"line": 5,
"column": 5
}
},
"id": {
"type": "Identifier",
"start": 84,
"end": 95,
"loc": {
"start": {
"line": 4,
"column": 10
},
"end": {
"line": 4,
"column": 21
},
"identifierName": "NestedClass"
},
"name": "NestedClass"
},
"superClass": null,
"body": {
"type": "ClassBody",
"start": 96,
"end": 103,
"loc": {
"start": {
"line": 4,
"column": 22
},
"end": {
"line": 5,
"column": 5
}
},
"body": []
}
}
],
"directives": []
}
}
]
}
}
}
],
"directives": []
}
}

View File

@@ -0,0 +1,4 @@
class A {
@a;
m(){}
}

View File

@@ -0,0 +1,3 @@
{
"throws": "Decorators must not be followed by a semicolon (2:5)"
}

View File

@@ -0,0 +1,3 @@
function* a() {
yield import('http');
}

View File

@@ -0,0 +1,171 @@
{
"type": "File",
"start": 0,
"end": 41,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 41,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 1
}
},
"sourceType": "script",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 41,
"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"
},
"generator": true,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 14,
"end": 41,
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 3,
"column": 1
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 18,
"end": 39,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 23
}
},
"expression": {
"type": "YieldExpression",
"start": 18,
"end": 38,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 22
}
},
"delegate": false,
"argument": {
"type": "CallExpression",
"start": 24,
"end": 38,
"loc": {
"start": {
"line": 2,
"column": 8
},
"end": {
"line": 2,
"column": 22
}
},
"callee": {
"type": "Import",
"start": 24,
"end": 30,
"loc": {
"start": {
"line": 2,
"column": 8
},
"end": {
"line": 2,
"column": 14
}
}
},
"arguments": [
{
"type": "StringLiteral",
"start": 31,
"end": 37,
"loc": {
"start": {
"line": 2,
"column": 15
},
"end": {
"line": 2,
"column": 21
}
},
"extra": {
"rawValue": "http",
"raw": "'http'"
},
"value": "http"
}
]
}
}
}
],
"directives": []
}
}
],
"directives": []
}
}

View File

@@ -0,0 +1,4 @@
/* hi */
function commentsAttachedToIdentifier() {
var x = (...args: any) => {};
}

View File

@@ -0,0 +1,275 @@
{
"type": "File",
"start": 0,
"end": 84,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 4,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 84,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 4,
"column": 1
}
},
"sourceType": "module",
"body": [
{
"type": "FunctionDeclaration",
"start": 9,
"end": 84,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 4,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 18,
"end": 46,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 37
},
"identifierName": "commentsAttachedToIdentifier"
},
"name": "commentsAttachedToIdentifier",
"leadingComments": null
},
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 49,
"end": 84,
"loc": {
"start": {
"line": 2,
"column": 40
},
"end": {
"line": 4,
"column": 1
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 53,
"end": 82,
"loc": {
"start": {
"line": 3,
"column": 2
},
"end": {
"line": 3,
"column": 31
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 57,
"end": 81,
"loc": {
"start": {
"line": 3,
"column": 6
},
"end": {
"line": 3,
"column": 30
}
},
"id": {
"type": "Identifier",
"start": 57,
"end": 58,
"loc": {
"start": {
"line": 3,
"column": 6
},
"end": {
"line": 3,
"column": 7
},
"identifierName": "x"
},
"name": "x"
},
"init": {
"type": "ArrowFunctionExpression",
"start": 61,
"end": 81,
"loc": {
"start": {
"line": 3,
"column": 10
},
"end": {
"line": 3,
"column": 30
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "RestElement",
"start": 62,
"end": 74,
"loc": {
"start": {
"line": 3,
"column": 11
},
"end": {
"line": 3,
"column": 23
}
},
"argument": {
"type": "Identifier",
"start": 65,
"end": 69,
"loc": {
"start": {
"line": 3,
"column": 14
},
"end": {
"line": 3,
"column": 18
},
"identifierName": "args"
},
"name": "args"
},
"typeAnnotation": {
"type": "TypeAnnotation",
"start": 69,
"end": 74,
"loc": {
"start": {
"line": 3,
"column": 18
},
"end": {
"line": 3,
"column": 23
}
},
"typeAnnotation": {
"type": "AnyTypeAnnotation",
"start": 71,
"end": 74,
"loc": {
"start": {
"line": 3,
"column": 20
},
"end": {
"line": 3,
"column": 23
}
}
}
}
}
],
"body": {
"type": "BlockStatement",
"start": 79,
"end": 81,
"loc": {
"start": {
"line": 3,
"column": 28
},
"end": {
"line": 3,
"column": 30
}
},
"body": [],
"directives": []
}
}
}
],
"kind": "var"
}
],
"directives": []
},
"leadingComments": [
{
"type": "CommentBlock",
"value": " hi ",
"start": 0,
"end": 8,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 8
}
}
}
]
}
],
"directives": []
},
"comments": [
{
"type": "CommentBlock",
"value": " hi ",
"start": 0,
"end": 8,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 8
}
}
}
]
}

View File

@@ -7,10 +7,10 @@ class A<T = string> {}
class A<T: ?string = string> {}
class A<S, T: ?string = string> {}
class A<S = number, T: ?string = string> {}
(class A<T = string> {})
(class A<T: ?string = string> {})
(class A<S, T: ?string = string> {})
(class A<S = number, T: ?string = string> {})
;(class A<T = string> {})
;(class A<T: ?string = string> {})
;(class A<S, T: ?string = string> {})
;(class A<S = number, T: ?string = string> {})
declare class A<T = string> {}
declare class A<T: ?string = string> {}
declare class A<S, T: ?string = string> {}

File diff suppressed because it is too large Load Diff