From 1bf302bede54e5b15a33f90a473df049c8a2858b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Wed, 24 Jul 2019 10:31:50 -0400 Subject: [PATCH] test: duplicate declare function and function would not throw --- .../dupl-decl-declare-func-func/options.json | 5 +- .../dupl-decl-declare-func-func/output.json | 168 ++++++++++++++++++ 2 files changed, 170 insertions(+), 3 deletions(-) create mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-func/output.json diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-func/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-func/options.json index e6924bc0cda3..7c91792f0e9c 100644 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-func/options.json +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-func/options.json @@ -3,6 +3,5 @@ "plugins": [ "jsx", "flow" - ], - "throws": "Identifier 'A' has already been declared (2:9)" -} \ No newline at end of file + ] +} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-func/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-func/output.json new file mode 100644 index 000000000000..44114ec35913 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-func/output.json @@ -0,0 +1,168 @@ +{ + "type": "File", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareFunction", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 26 + }, + "identifierName": "A" + }, + "name": "A", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 18, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "typeAnnotation": { + "type": "FunctionTypeAnnotation", + "start": 18, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "typeParameters": null, + "params": [], + "rest": null, + "returnType": { + "type": "VoidTypeAnnotation", + "start": 22, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + } + } + }, + "predicate": null + }, + { + "type": "FunctionDeclaration", + "start": 28, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "A" + }, + "name": "A" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 41, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file