diff --git a/Makefile b/Makefile index 7926e7e730..b0051a4efc 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ MAKEFLAGS = -j1 -FLOW_COMMIT = 622bbc4f07acb77eb1109830c70815f827401d90 +FLOW_COMMIT = f193e19cf2185006ea9139bb0e71f31ea93e7b72 TEST262_COMMIT = 52f70e2f637731aae92a9c9a2d831310c3ab2e1e # Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967 diff --git a/packages/babel-generator/src/generators/flow.js b/packages/babel-generator/src/generators/flow.js index 28418c9f90..86088bdd40 100644 --- a/packages/babel-generator/src/generators/flow.js +++ b/packages/babel-generator/src/generators/flow.js @@ -228,6 +228,12 @@ export function _interfaceish(node: Object) { this.space(); this.printList(node.mixins, node); } + if (node.implements && node.implements.length) { + this.space(); + this.word("implements"); + this.space(); + this.printList(node.implements, node); + } this.space(); this.print(node.body, node); } diff --git a/packages/babel-generator/test/fixtures/flow/implements/input.js b/packages/babel-generator/test/fixtures/flow/implements/input.js new file mode 100644 index 0000000000..32acd7162b --- /dev/null +++ b/packages/babel-generator/test/fixtures/flow/implements/input.js @@ -0,0 +1,5 @@ +class A implements B {} +class A implements B, C {} +declare class A implements B {} +declare class A mixins B implements C {} +declare class A implements B, C {} diff --git a/packages/babel-generator/test/fixtures/flow/implements/output.js b/packages/babel-generator/test/fixtures/flow/implements/output.js new file mode 100644 index 0000000000..6f2f016681 --- /dev/null +++ b/packages/babel-generator/test/fixtures/flow/implements/output.js @@ -0,0 +1,7 @@ +class A implements B {} + +class A implements B, C {} + +declare class A implements B {} +declare class A mixins B implements C {} +declare class A implements B, C {} \ No newline at end of file diff --git a/packages/babel-types/README.md b/packages/babel-types/README.md index aeb03d9bb9..d4b183a29b 100644 --- a/packages/babel-types/README.md +++ b/packages/babel-types/README.md @@ -433,6 +433,7 @@ Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` - `typeParameters`: `TypeParameterInstantiation` (default: `null`) - `extends`: `Array` (default: `null`) - `body`: `ObjectTypeAnnotation` (required) + - `implements`: `Array` (default: `null`) - `mixins`: `Array` (default: `null`) --- @@ -492,9 +493,10 @@ Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` - `id`: `Identifier` (required) - `typeParameters`: `TypeParameterDeclaration` (default: `null`) - - `extends`: `InterfaceExtends` (default: `null`) + - `extends`: `Array` (default: `null`) - `body`: `ObjectTypeAnnotation` (required) - - `mixins`: `Array` (default: `null`) + - `implements`: `Array` (default: `null`) + - `mixins`: `Array` (default: `null`) --- @@ -1038,8 +1040,9 @@ Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` - `id`: `Identifier` (required) - `typeParameters`: `TypeParameterDeclaration` (default: `null`) - - `extends`: `Array` (required) + - `extends`: `Array` (default: `null`) - `body`: `ObjectTypeAnnotation` (required) + - `implements`: `Array` (default: `null`) - `mixins`: `Array` (default: `null`) --- diff --git a/packages/babel-types/src/definitions/flow.js b/packages/babel-types/src/definitions/flow.js index ac947fb09e..5d58b24681 100644 --- a/packages/babel-types/src/definitions/flow.js +++ b/packages/babel-types/src/definitions/flow.js @@ -9,6 +9,32 @@ import defineType, { validateType, } from "./utils"; +const defineInterfaceishType = ( + name: string, + typeParameterType: string = "TypeParameterDeclaration", +) => { + defineType(name, { + builder: ["id", "typeParameters", "extends", "body"], + visitor: [ + "id", + "typeParameters", + "extends", + "mixins", + "implements", + "body", + ], + aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], + fields: { + id: validateType("Identifier"), + typeParameters: validateOptionalType(typeParameterType), + extends: validateOptional(arrayOfType("InterfaceExtends")), + mixins: validateOptional(arrayOfType("InterfaceExtends")), + implements: validateOptional(arrayOfType("ClassImplements")), + body: validateType("ObjectTypeAnnotation"), + }, + }); +}; + defineType("AnyTypeAnnotation", { aliases: ["Flow", "FlowType", "FlowBaseAnnotation"], }); @@ -46,17 +72,7 @@ defineType("ClassImplements", { }, }); -defineType("DeclareClass", { - visitor: ["id", "typeParameters", "extends", "body"], - aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], - fields: { - id: validateType("Identifier"), - typeParameters: validateOptionalType("TypeParameterInstantiation"), - extends: validateOptional(arrayOfType("InterfaceExtends")), - mixins: validateOptional(arrayOfType("InterfaceExtends")), - body: validateType("ObjectTypeAnnotation"), - }, -}); +defineInterfaceishType("DeclareClass", "TypeParameterInstantiation"); defineType("DeclareFunction", { visitor: ["id"], @@ -67,17 +83,7 @@ defineType("DeclareFunction", { }, }); -defineType("DeclareInterface", { - visitor: ["id", "typeParameters", "extends", "body"], - aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], - fields: { - id: validateType("Identifier"), - typeParameters: validateOptionalType("TypeParameterDeclaration"), - extends: validateOptionalType("InterfaceExtends"), - mixins: validateOptional(arrayOfType("Flow")), - body: validateType("ObjectTypeAnnotation"), - }, -}); +defineInterfaceishType("DeclareInterface"); defineType("DeclareModule", { builder: ["id", "body", "kind"], @@ -203,17 +209,7 @@ defineType("InterfaceExtends", { }, }); -defineType("InterfaceDeclaration", { - visitor: ["id", "typeParameters", "extends", "body"], - aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], - fields: { - id: validateType("Identifier"), - typeParameters: validateOptionalType("TypeParameterDeclaration"), - extends: validate(arrayOfType("InterfaceExtends")), - mixins: validate(arrayOfType("InterfaceExtends")), - body: validateType("ObjectTypeAnnotation"), - }, -}); +defineInterfaceishType("InterfaceDeclaration"); defineType("IntersectionTypeAnnotation", { visitor: ["types"], diff --git a/packages/babylon/src/plugins/flow.js b/packages/babylon/src/plugins/flow.js index f9f4c02048..2e54cb4fdb 100644 --- a/packages/babylon/src/plugins/flow.js +++ b/packages/babylon/src/plugins/flow.js @@ -403,6 +403,7 @@ export default (superClass: Class): Class => } node.extends = []; + node.implements = []; node.mixins = []; if (this.eat(tt._extends)) { @@ -418,6 +419,13 @@ export default (superClass: Class): Class => } while (this.eat(tt.comma)); } + if (this.isContextual("implements")) { + this.next(); + do { + node.implements.push(this.flowParseInterfaceExtends()); + } while (this.eat(tt.comma)); + } + node.body = this.flowParseObjectType(true, false, false); } diff --git a/packages/babylon/test/fixtures/flow/call-properties/5/output.json b/packages/babylon/test/fixtures/flow/call-properties/5/output.json index 74587ef411..306d17dc8c 100644 --- a/packages/babylon/test/fixtures/flow/call-properties/5/output.json +++ b/packages/babylon/test/fixtures/flow/call-properties/5/output.json @@ -61,6 +61,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/class-properties/getter-setter/output.json b/packages/babylon/test/fixtures/flow/class-properties/getter-setter/output.json index d2e591f280..9439a28902 100644 --- a/packages/babylon/test/fixtures/flow/class-properties/getter-setter/output.json +++ b/packages/babylon/test/fixtures/flow/class-properties/getter-setter/output.json @@ -61,6 +61,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/class-properties/named-static/output.json b/packages/babylon/test/fixtures/flow/class-properties/named-static/output.json index bdec47c1a5..cb362f9359 100644 --- a/packages/babylon/test/fixtures/flow/class-properties/named-static/output.json +++ b/packages/babylon/test/fixtures/flow/class-properties/named-static/output.json @@ -61,6 +61,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/classes/implements-multiple/input.js b/packages/babylon/test/fixtures/flow/classes/implements-multiple/input.js new file mode 100644 index 0000000000..59345566e7 --- /dev/null +++ b/packages/babylon/test/fixtures/flow/classes/implements-multiple/input.js @@ -0,0 +1 @@ +class A implements B, C {} diff --git a/packages/babylon/test/fixtures/flow/classes/implements-multiple/output.json b/packages/babylon/test/fixtures/flow/classes/implements-multiple/output.json new file mode 100644 index 0000000000..d1857f6c95 --- /dev/null +++ b/packages/babylon/test/fixtures/flow/classes/implements-multiple/output.json @@ -0,0 +1,151 @@ +{ + "type": "File", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "sourceType": "module", + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "implements": [ + { + "type": "ClassImplements", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "B" + }, + "name": "B" + }, + "typeParameters": null + }, + { + "type": "ClassImplements", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "id": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "C" + }, + "name": "C" + }, + "typeParameters": null + } + ], + "body": { + "type": "ClassBody", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babylon/test/fixtures/flow/classes/implements/input.js b/packages/babylon/test/fixtures/flow/classes/implements/input.js new file mode 100644 index 0000000000..774eb9795a --- /dev/null +++ b/packages/babylon/test/fixtures/flow/classes/implements/input.js @@ -0,0 +1 @@ +class A implements B {} diff --git a/packages/babylon/test/fixtures/flow/classes/implements/output.json b/packages/babylon/test/fixtures/flow/classes/implements/output.json new file mode 100644 index 0000000000..7eeb588da8 --- /dev/null +++ b/packages/babylon/test/fixtures/flow/classes/implements/output.json @@ -0,0 +1,118 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "module", + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "implements": [ + { + "type": "ClassImplements", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "B" + }, + "name": "B" + }, + "typeParameters": null + } + ], + "body": { + "type": "ClassBody", + "start": 21, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babylon/test/fixtures/flow/classes/mixins-error/input.js b/packages/babylon/test/fixtures/flow/classes/mixins-error/input.js new file mode 100644 index 0000000000..773a7d6dee --- /dev/null +++ b/packages/babylon/test/fixtures/flow/classes/mixins-error/input.js @@ -0,0 +1 @@ +class A mixins B {} diff --git a/packages/babylon/test/fixtures/flow/classes/mixins-error/options.json b/packages/babylon/test/fixtures/flow/classes/mixins-error/options.json new file mode 100644 index 0000000000..2957be2fe4 --- /dev/null +++ b/packages/babylon/test/fixtures/flow/classes/mixins-error/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Unexpected token, expected \"{\" (1:8)" +} diff --git a/packages/babylon/test/fixtures/flow/declare-class/implements-multiple/input.js b/packages/babylon/test/fixtures/flow/declare-class/implements-multiple/input.js new file mode 100644 index 0000000000..9132ccd309 --- /dev/null +++ b/packages/babylon/test/fixtures/flow/declare-class/implements-multiple/input.js @@ -0,0 +1 @@ +declare class A implements B, C {} diff --git a/packages/babylon/test/fixtures/flow/declare-class/implements-multiple/output.json b/packages/babylon/test/fixtures/flow/declare-class/implements-multiple/output.json new file mode 100644 index 0000000000..d542929729 --- /dev/null +++ b/packages/babylon/test/fixtures/flow/declare-class/implements-multiple/output.json @@ -0,0 +1,156 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "sourceType": "module", + "body": [ + { + "type": "DeclareClass", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "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": [ + { + "type": "InterfaceExtends", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "id": { + "type": "Identifier", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + }, + "identifierName": "B" + }, + "name": "B" + }, + "typeParameters": null + }, + { + "type": "InterfaceExtends", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "id": { + "type": "Identifier", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + }, + "identifierName": "C" + }, + "name": "C" + }, + "typeParameters": null + } + ], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 32, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babylon/test/fixtures/flow/declare-class/implements-with-mixin-order/input.js b/packages/babylon/test/fixtures/flow/declare-class/implements-with-mixin-order/input.js new file mode 100644 index 0000000000..aef489825d --- /dev/null +++ b/packages/babylon/test/fixtures/flow/declare-class/implements-with-mixin-order/input.js @@ -0,0 +1 @@ +declare class A implements B mixins C {} diff --git a/packages/babylon/test/fixtures/flow/declare-class/implements-with-mixin-order/options.json b/packages/babylon/test/fixtures/flow/declare-class/implements-with-mixin-order/options.json new file mode 100644 index 0000000000..8920601d7c --- /dev/null +++ b/packages/babylon/test/fixtures/flow/declare-class/implements-with-mixin-order/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Unexpected token, expected \"{\" (1:29)" +} diff --git a/packages/babylon/test/fixtures/flow/declare-class/implements-with-mixin/input.js b/packages/babylon/test/fixtures/flow/declare-class/implements-with-mixin/input.js new file mode 100644 index 0000000000..045b763b6e --- /dev/null +++ b/packages/babylon/test/fixtures/flow/declare-class/implements-with-mixin/input.js @@ -0,0 +1 @@ +declare class A mixins B implements C {} diff --git a/packages/babylon/test/fixtures/flow/declare-class/implements-with-mixin/output.json b/packages/babylon/test/fixtures/flow/declare-class/implements-with-mixin/output.json new file mode 100644 index 0000000000..90a3ce2742 --- /dev/null +++ b/packages/babylon/test/fixtures/flow/declare-class/implements-with-mixin/output.json @@ -0,0 +1,157 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "sourceType": "module", + "body": [ + { + "type": "DeclareClass", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "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": [ + { + "type": "InterfaceExtends", + "start": 36, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "id": { + "type": "Identifier", + "start": 36, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + }, + "identifierName": "C" + }, + "name": "C" + }, + "typeParameters": null + } + ], + "mixins": [ + { + "type": "InterfaceExtends", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "B" + }, + "name": "B" + }, + "typeParameters": null + } + ], + "body": { + "type": "ObjectTypeAnnotation", + "start": 38, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babylon/test/fixtures/flow/declare-class/implements/input.js b/packages/babylon/test/fixtures/flow/declare-class/implements/input.js new file mode 100644 index 0000000000..35893a6f9b --- /dev/null +++ b/packages/babylon/test/fixtures/flow/declare-class/implements/input.js @@ -0,0 +1 @@ +declare class A implements B {} diff --git a/packages/babylon/test/fixtures/flow/declare-class/implements/output.json b/packages/babylon/test/fixtures/flow/declare-class/implements/output.json new file mode 100644 index 0000000000..2b6e2f9226 --- /dev/null +++ b/packages/babylon/test/fixtures/flow/declare-class/implements/output.json @@ -0,0 +1,123 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "sourceType": "module", + "body": [ + { + "type": "DeclareClass", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "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": [ + { + "type": "InterfaceExtends", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "id": { + "type": "Identifier", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + }, + "identifierName": "B" + }, + "name": "B" + }, + "typeParameters": null + } + ], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babylon/test/fixtures/flow/declare-class/mixins-multiple/input.js b/packages/babylon/test/fixtures/flow/declare-class/mixins-multiple/input.js new file mode 100644 index 0000000000..caa2cc2f2c --- /dev/null +++ b/packages/babylon/test/fixtures/flow/declare-class/mixins-multiple/input.js @@ -0,0 +1 @@ +declare class A mixins B, C {} diff --git a/packages/babylon/test/fixtures/flow/declare-class/mixins-multiple/output.json b/packages/babylon/test/fixtures/flow/declare-class/mixins-multiple/output.json new file mode 100644 index 0000000000..2e0c40e321 --- /dev/null +++ b/packages/babylon/test/fixtures/flow/declare-class/mixins-multiple/output.json @@ -0,0 +1,156 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "sourceType": "module", + "body": [ + { + "type": "DeclareClass", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "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": [ + { + "type": "InterfaceExtends", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "B" + }, + "name": "B" + }, + "typeParameters": null + }, + { + "type": "InterfaceExtends", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "id": { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + }, + "identifierName": "C" + }, + "name": "C" + }, + "typeParameters": null + } + ], + "body": { + "type": "ObjectTypeAnnotation", + "start": 28, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babylon/test/fixtures/flow/declare-class/mixins/input.js b/packages/babylon/test/fixtures/flow/declare-class/mixins/input.js new file mode 100644 index 0000000000..bc8b256f85 --- /dev/null +++ b/packages/babylon/test/fixtures/flow/declare-class/mixins/input.js @@ -0,0 +1 @@ +declare class A mixins B {} diff --git a/packages/babylon/test/fixtures/flow/declare-class/mixins/output.json b/packages/babylon/test/fixtures/flow/declare-class/mixins/output.json new file mode 100644 index 0000000000..4dc1aceddf --- /dev/null +++ b/packages/babylon/test/fixtures/flow/declare-class/mixins/output.json @@ -0,0 +1,123 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "sourceType": "module", + "body": [ + { + "type": "DeclareClass", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "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": [ + { + "type": "InterfaceExtends", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "B" + }, + "name": "B" + }, + "typeParameters": null + } + ], + "body": { + "type": "ObjectTypeAnnotation", + "start": 25, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babylon/test/fixtures/flow/declare-export/export-class/output.json b/packages/babylon/test/fixtures/flow/declare-export/export-class/output.json index 4150ba6490..98d369c164 100644 --- a/packages/babylon/test/fixtures/flow/declare-export/export-class/output.json +++ b/packages/babylon/test/fixtures/flow/declare-export/export-class/output.json @@ -124,6 +124,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/declare-export/export-default-class/output.json b/packages/babylon/test/fixtures/flow/declare-export/export-default-class/output.json index 62d258e3a7..61983df103 100644 --- a/packages/babylon/test/fixtures/flow/declare-export/export-default-class/output.json +++ b/packages/babylon/test/fixtures/flow/declare-export/export-default-class/output.json @@ -75,6 +75,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/declare-export/export-interface-and-var/output.json b/packages/babylon/test/fixtures/flow/declare-export/export-interface-and-var/output.json index c793dc2bb5..a5e525c737 100644 --- a/packages/babylon/test/fixtures/flow/declare-export/export-interface-and-var/output.json +++ b/packages/babylon/test/fixtures/flow/declare-export/export-interface-and-var/output.json @@ -126,6 +126,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/declare-export/export-interface-commonjs/output.json b/packages/babylon/test/fixtures/flow/declare-export/export-interface-commonjs/output.json index 9263cc2989..39e702dea8 100644 --- a/packages/babylon/test/fixtures/flow/declare-export/export-interface-commonjs/output.json +++ b/packages/babylon/test/fixtures/flow/declare-export/export-interface-commonjs/output.json @@ -126,6 +126,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/declare-export/export-interface/output.json b/packages/babylon/test/fixtures/flow/declare-export/export-interface/output.json index 2524845b73..423ce5adf1 100644 --- a/packages/babylon/test/fixtures/flow/declare-export/export-interface/output.json +++ b/packages/babylon/test/fixtures/flow/declare-export/export-interface/output.json @@ -126,6 +126,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/declare-module/5/output.json b/packages/babylon/test/fixtures/flow/declare-module/5/output.json index 80be55a8c3..5ce1498f42 100644 --- a/packages/babylon/test/fixtures/flow/declare-module/5/output.json +++ b/packages/babylon/test/fixtures/flow/declare-module/5/output.json @@ -107,6 +107,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/declare-statements/10/output.json b/packages/babylon/test/fixtures/flow/declare-statements/10/output.json index 5342db2957..1bcf3e6e9e 100644 --- a/packages/babylon/test/fixtures/flow/declare-statements/10/output.json +++ b/packages/babylon/test/fixtures/flow/declare-statements/10/output.json @@ -61,6 +61,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/declare-statements/11/output.json b/packages/babylon/test/fixtures/flow/declare-statements/11/output.json index 6c57828705..5c95cf2a5b 100644 --- a/packages/babylon/test/fixtures/flow/declare-statements/11/output.json +++ b/packages/babylon/test/fixtures/flow/declare-statements/11/output.json @@ -61,6 +61,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/declare-statements/12/output.json b/packages/babylon/test/fixtures/flow/declare-statements/12/output.json index d7e3836060..4460f260fb 100644 --- a/packages/babylon/test/fixtures/flow/declare-statements/12/output.json +++ b/packages/babylon/test/fixtures/flow/declare-statements/12/output.json @@ -61,6 +61,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/declare-statements/13/output.json b/packages/babylon/test/fixtures/flow/declare-statements/13/output.json index 2e0f0e768e..b9f0125e9a 100644 --- a/packages/babylon/test/fixtures/flow/declare-statements/13/output.json +++ b/packages/babylon/test/fixtures/flow/declare-statements/13/output.json @@ -61,6 +61,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [ { "type": "InterfaceExtends", diff --git a/packages/babylon/test/fixtures/flow/declare-statements/15/output.json b/packages/babylon/test/fixtures/flow/declare-statements/15/output.json index b1cffdd603..3208fef5b5 100644 --- a/packages/babylon/test/fixtures/flow/declare-statements/15/output.json +++ b/packages/babylon/test/fixtures/flow/declare-statements/15/output.json @@ -61,6 +61,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", @@ -201,6 +202,7 @@ ] }, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/declare-statements/16/output.json b/packages/babylon/test/fixtures/flow/declare-statements/16/output.json index 63647f77c7..68a1978b51 100644 --- a/packages/babylon/test/fixtures/flow/declare-statements/16/output.json +++ b/packages/babylon/test/fixtures/flow/declare-statements/16/output.json @@ -159,6 +159,7 @@ "typeParameters": null } ], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/declare-statements/17/output.json b/packages/babylon/test/fixtures/flow/declare-statements/17/output.json index 3f679259e7..3279562c14 100644 --- a/packages/babylon/test/fixtures/flow/declare-statements/17/output.json +++ b/packages/babylon/test/fixtures/flow/declare-statements/17/output.json @@ -61,6 +61,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/declare-statements/18/output.json b/packages/babylon/test/fixtures/flow/declare-statements/18/output.json index 4c3d432e19..3c4cd37283 100644 --- a/packages/babylon/test/fixtures/flow/declare-statements/18/output.json +++ b/packages/babylon/test/fixtures/flow/declare-statements/18/output.json @@ -61,6 +61,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", @@ -165,6 +166,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/declare-statements/7/output.json b/packages/babylon/test/fixtures/flow/declare-statements/7/output.json index 41df008a59..57e98a51ee 100644 --- a/packages/babylon/test/fixtures/flow/declare-statements/7/output.json +++ b/packages/babylon/test/fixtures/flow/declare-statements/7/output.json @@ -61,6 +61,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/declare-statements/8/output.json b/packages/babylon/test/fixtures/flow/declare-statements/8/output.json index 3f5d39aa5f..9ae134f7ae 100644 --- a/packages/babylon/test/fixtures/flow/declare-statements/8/output.json +++ b/packages/babylon/test/fixtures/flow/declare-statements/8/output.json @@ -61,6 +61,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/declare-statements/9/output.json b/packages/babylon/test/fixtures/flow/declare-statements/9/output.json index 5c887c2d78..757e446721 100644 --- a/packages/babylon/test/fixtures/flow/declare-statements/9/output.json +++ b/packages/babylon/test/fixtures/flow/declare-statements/9/output.json @@ -177,6 +177,7 @@ } } ], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/interfaces-module-and-script/1/output.json b/packages/babylon/test/fixtures/flow/interfaces-module-and-script/1/output.json index 005f5ae9d3..2ea75fd807 100644 --- a/packages/babylon/test/fixtures/flow/interfaces-module-and-script/1/output.json +++ b/packages/babylon/test/fixtures/flow/interfaces-module-and-script/1/output.json @@ -61,6 +61,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/interfaces-module-and-script/10/output.json b/packages/babylon/test/fixtures/flow/interfaces-module-and-script/10/output.json index 1260b7fcbb..8bebb8ba55 100644 --- a/packages/babylon/test/fixtures/flow/interfaces-module-and-script/10/output.json +++ b/packages/babylon/test/fixtures/flow/interfaces-module-and-script/10/output.json @@ -61,6 +61,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/interfaces-module-and-script/2/output.json b/packages/babylon/test/fixtures/flow/interfaces-module-and-script/2/output.json index 044027ca74..eb8ac60e38 100644 --- a/packages/babylon/test/fixtures/flow/interfaces-module-and-script/2/output.json +++ b/packages/babylon/test/fixtures/flow/interfaces-module-and-script/2/output.json @@ -95,6 +95,7 @@ "typeParameters": null } ], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/interfaces-module-and-script/3/output.json b/packages/babylon/test/fixtures/flow/interfaces-module-and-script/3/output.json index 2f896014d6..9212a82374 100644 --- a/packages/babylon/test/fixtures/flow/interfaces-module-and-script/3/output.json +++ b/packages/babylon/test/fixtures/flow/interfaces-module-and-script/3/output.json @@ -259,6 +259,7 @@ } } ], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/interfaces-module-and-script/4/output.json b/packages/babylon/test/fixtures/flow/interfaces-module-and-script/4/output.json index 492840fe45..2705283764 100644 --- a/packages/babylon/test/fixtures/flow/interfaces-module-and-script/4/output.json +++ b/packages/babylon/test/fixtures/flow/interfaces-module-and-script/4/output.json @@ -61,6 +61,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/interfaces-module-and-script/5/output.json b/packages/babylon/test/fixtures/flow/interfaces-module-and-script/5/output.json index 5076c34a90..2114abd4bf 100644 --- a/packages/babylon/test/fixtures/flow/interfaces-module-and-script/5/output.json +++ b/packages/babylon/test/fixtures/flow/interfaces-module-and-script/5/output.json @@ -61,6 +61,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/interfaces-module-and-script/id-reserved-value/output.json b/packages/babylon/test/fixtures/flow/interfaces-module-and-script/id-reserved-value/output.json index af2de65896..2fc2a10be8 100644 --- a/packages/babylon/test/fixtures/flow/interfaces-module-and-script/id-reserved-value/output.json +++ b/packages/babylon/test/fixtures/flow/interfaces-module-and-script/id-reserved-value/output.json @@ -61,6 +61,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/iterator/01/output.json b/packages/babylon/test/fixtures/flow/iterator/01/output.json index c8b579bc72..3275f3a0b9 100644 --- a/packages/babylon/test/fixtures/flow/iterator/01/output.json +++ b/packages/babylon/test/fixtures/flow/iterator/01/output.json @@ -61,6 +61,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/iterator/02/output.json b/packages/babylon/test/fixtures/flow/iterator/02/output.json index 0b5dd41ee4..8d0a7d2c0f 100644 --- a/packages/babylon/test/fixtures/flow/iterator/02/output.json +++ b/packages/babylon/test/fixtures/flow/iterator/02/output.json @@ -61,6 +61,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/iterator/14/output.json b/packages/babylon/test/fixtures/flow/iterator/14/output.json index 79013398e6..78e416e067 100644 --- a/packages/babylon/test/fixtures/flow/iterator/14/output.json +++ b/packages/babylon/test/fixtures/flow/iterator/14/output.json @@ -61,6 +61,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/iterator/15/output.json b/packages/babylon/test/fixtures/flow/iterator/15/output.json index c9a648a19c..02ed08c46b 100644 --- a/packages/babylon/test/fixtures/flow/iterator/15/output.json +++ b/packages/babylon/test/fixtures/flow/iterator/15/output.json @@ -61,6 +61,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/type-annotations/object-type-method/output.json b/packages/babylon/test/fixtures/flow/type-annotations/object-type-method/output.json index aefcaa1c07..3033b68e37 100644 --- a/packages/babylon/test/fixtures/flow/type-annotations/object-type-method/output.json +++ b/packages/babylon/test/fixtures/flow/type-annotations/object-type-method/output.json @@ -921,6 +921,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", @@ -1045,6 +1046,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", @@ -1169,6 +1171,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", @@ -1273,6 +1276,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/type-exports/interface/output.json b/packages/babylon/test/fixtures/flow/type-exports/interface/output.json index 1e95a36e2b..f8cc2f9749 100644 --- a/packages/babylon/test/fixtures/flow/type-exports/interface/output.json +++ b/packages/babylon/test/fixtures/flow/type-exports/interface/output.json @@ -78,6 +78,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", @@ -251,6 +252,7 @@ ] }, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/type-parameter-declaration/declare-class-method-reserved-word/output.json b/packages/babylon/test/fixtures/flow/type-parameter-declaration/declare-class-method-reserved-word/output.json index f238f8f968..21c1ee39f8 100644 --- a/packages/babylon/test/fixtures/flow/type-parameter-declaration/declare-class-method-reserved-word/output.json +++ b/packages/babylon/test/fixtures/flow/type-parameter-declaration/declare-class-method-reserved-word/output.json @@ -61,6 +61,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/type-parameter-declaration/declare-interface-method-reserved-word/output.json b/packages/babylon/test/fixtures/flow/type-parameter-declaration/declare-interface-method-reserved-word/output.json index 03814b48e8..c38e1e5f03 100644 --- a/packages/babylon/test/fixtures/flow/type-parameter-declaration/declare-interface-method-reserved-word/output.json +++ b/packages/babylon/test/fixtures/flow/type-parameter-declaration/declare-interface-method-reserved-word/output.json @@ -61,6 +61,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/type-parameter-declaration/default/output.json b/packages/babylon/test/fixtures/flow/type-parameter-declaration/default/output.json index 56cf6e37d7..2f5255f913 100644 --- a/packages/babylon/test/fixtures/flow/type-parameter-declaration/default/output.json +++ b/packages/babylon/test/fixtures/flow/type-parameter-declaration/default/output.json @@ -2106,6 +2106,7 @@ ] }, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", @@ -2253,6 +2254,7 @@ ] }, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", @@ -2417,6 +2419,7 @@ ] }, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", @@ -2596,6 +2599,7 @@ ] }, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", @@ -2698,6 +2702,7 @@ ] }, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", @@ -2845,6 +2850,7 @@ ] }, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", @@ -3009,6 +3015,7 @@ ] }, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", @@ -3188,6 +3195,7 @@ ] }, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/packages/babylon/test/fixtures/flow/type-parameter-declaration/interface-reserved-word/output.json b/packages/babylon/test/fixtures/flow/type-parameter-declaration/interface-reserved-word/output.json index 0d65a9a6c5..2811767bec 100644 --- a/packages/babylon/test/fixtures/flow/type-parameter-declaration/interface-reserved-word/output.json +++ b/packages/babylon/test/fixtures/flow/type-parameter-declaration/interface-reserved-word/output.json @@ -61,6 +61,7 @@ }, "typeParameters": null, "extends": [], + "implements": [], "mixins": [], "body": { "type": "ObjectTypeAnnotation", diff --git a/scripts/tests/flow/flow_tests_whitelist.txt b/scripts/tests/flow/flow_tests_whitelist.txt index 77bc9b9cc2..11303cbc2b 100644 --- a/scripts/tests/flow/flow_tests_whitelist.txt +++ b/scripts/tests/flow/flow_tests_whitelist.txt @@ -39,8 +39,6 @@ types/annotations_in_comments_invalid/migrated_0003.js types/annotations/static_is_reserved_param.js types/annotations/static_is_reserved_type.js types/annotations/void_is_reserved_param.js -types/declare_export_invalid/migrated_0013.js -types/declare_statements_invalid/migrated_0001.js types/member/reserved_words.js types/number_literal_invalid/migrated_0000.js types/parameter_defaults/migrated_0023.js @@ -52,3 +50,5 @@ types/parameter_defaults/migrated_0031.js types/parameter_defaults/migrated_0032.js types/string_literal_invalid/migrated_0000.js types/typecasts_invalid/migrated_0001.js +class_method_kinds/polymorphic_getter.js +types/interfaces/prop_named_static.js diff --git a/scripts/tests/flow/run_babylon_flow_tests.js b/scripts/tests/flow/run_babylon_flow_tests.js index a17d629465..fb6b0b1f68 100644 --- a/scripts/tests/flow/run_babylon_flow_tests.js +++ b/scripts/tests/flow/run_babylon_flow_tests.js @@ -115,6 +115,7 @@ const flowOptionsMapping = { esproposal_class_static_fields: "classProperties", esproposal_export_star_as: "exportNamespaceFrom", esproposal_decorators: "decorators", + esproposal_optional_chaining: "optionalChaining", types: "flowComments", }; diff --git a/yarn.lock b/yarn.lock index 742a5ed7d1..b0c78dd61a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1246,10 +1246,6 @@ assert@^1.1.1, assert@^1.4.0: dependencies: util "0.10.3" -assertion-error@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b" - assign-symbols@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" @@ -1883,17 +1879,6 @@ center-align@^0.1.1: align-text "^0.1.3" lazy-cache "^1.0.3" -chai@^4.1.0: - version "4.1.2" - resolved "https://registry.yarnpkg.com/chai/-/chai-4.1.2.tgz#0f64584ba642f0f2ace2806279f4f06ca23ad73c" - dependencies: - assertion-error "^1.0.1" - check-error "^1.0.1" - deep-eql "^3.0.0" - get-func-name "^2.0.0" - pathval "^1.0.0" - type-detect "^4.0.0" - chalk@^1.0.0, chalk@^1.1.1, chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" @@ -1920,10 +1905,6 @@ chardet@^0.4.0: version "0.4.2" resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2" -check-error@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82" - cheerio@^1.0.0-rc.1: version "1.0.0-rc.2" resolved "https://registry.yarnpkg.com/cheerio/-/cheerio-1.0.0-rc.2.tgz#4b9f53a81b27e4d5dac31c0ffd0cfa03cc6830db" @@ -2554,12 +2535,6 @@ dedent@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" -deep-eql@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-3.0.1.tgz#dfc9404400ad1c8fe023e7da1df1c147c4b444df" - dependencies: - type-detect "^4.0.0" - deep-extend@~0.4.0: version "0.4.2" resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.2.tgz#48b699c27e334bf89f10892be432f6e4c7d34a7f" @@ -3513,10 +3488,6 @@ get-caller-file@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.2.tgz#f702e63127e7e231c160a80c1554acb70d5047e5" -get-func-name@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.0.tgz#ead774abee72e20409433a066366023dd6887a41" - get-own-enumerable-property-symbols@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-2.0.1.tgz#5c4ad87f2834c4b9b4e84549dc1e0650fb38c24b" @@ -6217,10 +6188,6 @@ path-type@^3.0.0: dependencies: pify "^3.0.0" -pathval@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.0.tgz#b942e6d4bde653005ef6b71361def8727d0645e0" - pbkdf2@^3.0.3: version "3.0.14" resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.14.tgz#a35e13c64799b06ce15320f459c230e68e73bade" @@ -7634,10 +7601,6 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" -type-detect@^4.0.0: - version "4.0.8" - resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" - typedarray@^0.0.6, typedarray@~0.0.5: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"